NetBSD Problem Report #50607

From www@NetBSD.org  Sat Jan  2 12:04:20 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.NetBSD.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 926617ACA2
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  2 Jan 2016 12:04:20 +0000 (UTC)
Message-Id: <20160102120419.A866E7ACAA@mollari.NetBSD.org>
Date: Sat,  2 Jan 2016 12:04:19 +0000 (UTC)
From: pooka@iki.fi
Reply-To: pooka@iki.fi
To: gnats-bugs@NetBSD.org
Subject: ext2 repeatable kernel panic when creating files
X-Send-Pr-Version: www-1.0

>Number:         50607
>Category:       kern
>Synopsis:       ext2 repeatable kernel panic when creating files
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 02 12:05:00 +0000 2016
>Closed-Date:    Wed Jan 13 12:10:53 +0000 2016
>Last-Modified:  Wed Jan 13 12:10:53 +0000 2016
>Originator:     Antti Kantee
>Release:        -current sometime after 7.0
>Organization:
>Environment:
>Description:
The ext2 driver dies if it needs to expand the directory when creating a file.  The problem exists only in -current, not NetBSD 7.
>How-To-Repeat:
run tests/fs/vfs/t_vnops::create_many for ext2

https://releng.netbsd.org/b5reports/i386/build/2016.01.01.15.18.39/test.html#fs_vfs_t_vnops_ext2fs_create_many
>Fix:

>Release-Note:

>Audit-Trail:
From: Taylor R Campbell <riastradh@NetBSD.org>
To: netbsd-bugs@NetBSD.org, gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/50607: ext2 repeatable kernel panic when creating files
Date: Mon, 4 Jan 2016 17:54:01 +0000

 This is a multi-part message in MIME format.
 --=_CBDx9VyOVHVmwn5krjIDO84KIUHB5Fqj

 My fault.  Here's the message I sent pooka about how to fix it.

 --=_CBDx9VyOVHVmwn5krjIDO84KIUHB5Fqj
 Content-Type: message/rfc822
 Content-Disposition: inline

 Date: Sat, 2 Jan 2016 16:50:01 +0000
 From: Taylor R Campbell <campbell@mumble.net>
 To: Antti Kantee <pooka@iki.fi>
 Subject: Re: ext2 and "Disentangle buffer-cached I/O from page-cached I/O in UFS."
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit

    Date: Fri, 1 Jan 2016 13:17:36 +0000
    From: Antti Kantee <pooka@iki.fi>

    There's a problem which seems to be a derivative of your work from some 
    months ago.  ext2fs_write() now at least KASSERTs that vp->v_type == 
    VREG, but ext2fs_direnter() uses VOP_WRITE() for the dvp, so that 
    invariant is false.

    Are those changes still in your cache?  Can you look at it ASAP?  I'll 
    probably dig in later today if not, but since there's a chance you can 
    fix it with a minute of effort, I guess it's worth a shot.

 Well, OOPS.  I don't have time to draft or test a fix right now until
 Monday or Tuesday, but that's a pretty embarrassing mistake on my
 part.  I'm not sure how it ever passed any tests!

 ufs uses buffercache I/O directly for directory operations, using
 VOP_BWRITE, and I must have assumed without checking that ext2fs does
 so too.  But ext2fs was based on ufs code before softdeps (circa
 1997), and ufs wasn't made to use VOP_BWRITE until 1999 when the
 softdep code was merged.

 There are two obvious resolutions:

 1. Fix it by adapting ext2fs_direnter to use buffercache(9) like
 ufs_direnter does.

 2. Provisionally work around it by putting a conditional in
 ext2fs_write for VDIR which dispatches to ext2fs_bufwr like
 ext2fs_read does to ext2fs_bufrd.

 If you don't have time to do one of these rihgt now, I can take a shot
 at it on Monday or Tuesday.

 (Happy new year!)

 --=_CBDx9VyOVHVmwn5krjIDO84KIUHB5Fqj--

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/50607: ext2 repeatable kernel panic when creating files
Date: Mon, 4 Jan 2016 12:38:58 -0600 (CST)

 Looks like this is the same as:

   port-evbmips/50059

 I filed it as port-evbmips since so many other things seem to be wrong
 with that port.  Also, I don't currently have any other machines using
 ext2fs filesystems, otherwise I might have found it earlier.


 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50607 CVS commit: src/sys/ufs/ext2fs
Date: Tue, 12 Jan 2016 21:29:29 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Tue Jan 12 21:29:29 UTC 2016

 Modified Files:
 	src/sys/ufs/ext2fs: ext2fs_lookup.c

 Log Message:
 Use buffer cache, not page cache, to expand directories in ext2fs.

 Candidate fix for PR kern/50607, PR port-evbmips/50059.

 Formerly VOP_WRITE-->ext2fs_write would automatically dispatch to
 this code path for writes to directories, but I broke that in
 ext2fs_lookup.c rev. 1.78 when disentangling page-cached and
 buffer-cached writes.

 This was not a problem in ufs, and I didn't notice it in ext2fs,
 because ufs consistently used buffercache(9) directly instead of
 using VOP_WRITE sometimes as ext2fs did.


 To generate a diff of this commit:
 cvs rdiff -u -r1.78 -r1.79 src/sys/ufs/ext2fs/ext2fs_lookup.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Antti Kantee" <pooka@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50607 CVS commit: src/tests/fs/vfs
Date: Wed, 13 Jan 2016 12:05:49 +0000

 Module Name:	src
 Committed By:	pooka
 Date:		Wed Jan 13 12:05:49 UTC 2016

 Modified Files:
 	src/tests/fs/vfs: t_vnops.c

 Log Message:
 create_many: remove PR kern/50607 xfail

 Seems to have been fixed by ext2fs_lookup.c 1.79
 (thanks, riastradh)


 To generate a diff of this commit:
 cvs rdiff -u -r1.52 -r1.53 src/tests/fs/vfs/t_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: pooka@NetBSD.org
State-Changed-When: Wed, 13 Jan 2016 12:10:53 +0000
State-Changed-Why:
fixed


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.