Date: Mon, 17 May 2004 15:55:18 -0700 (PDT) From: John-Mark Gurney <jmg@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/66781: softupdate code causes panic Message-ID: <200405172255.i4HMtIjS054126@freefall.freebsd.org> Resent-Message-ID: <200405172300.i4HN0Vj5054318@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 66781 >Category: kern >Synopsis: softupdate code causes panic >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon May 17 16:00:30 PDT 2004 >Closed-Date: >Last-Modified: >Originator: John-Mark Gurney >Release: FreeBSD RELENG_4 >Organization: Cu Networking >Environment: System: FreeBSD freefall.freebsd.org 4.10-RC FreeBSD 4.10-RC #12: Sun Apr 25 14:35:16 PDT 2004 kensmith@freefall.freebsd.org:/c/src/sys/compile/FREEFALL i386 any -stable box with softupdates enabled on a file system. >Description: softupdate code will cause a panic trying to lock a buffer when the buffer already has been locked... BUF_LOCK(0xc6450440) (pid 1378) in getdirtybuf: 0 called getdirtybuf(0xc6450440, MNT_WAIT) in softdep_sync_metadata: 1 D_BMSAFEMAP: getdirtybuf(0xc6450440) BUF_LOCK(0xc6450440) (pid 1378) in getdirtbuf: 16 panic: lockmgr: locking against myself sorry I don't have a more extensive panic, but re@ has confirmed this on latest RELENG_4. >How-To-Repeat: When running the following script: #!/bin/sh - # # Script to do some torture tests on the FS and expose a Softdep bug. # # device should be the device node of where dir is mounted. # device=/dev/da1s1e dir=/sql cd "$dir" while true; do mkdir testcrap cd testcrap mkdir -p a/b/c/d/e/f/g touch a/aa rm a/aa mkdir a/bb a/cc a/dd a/ee a/ff touch a/b/bb mkdir a/b/aa a/b/bc a/b/cc a/b/dd touch a/b/c/cc touch a/b/c/d/dd touch a/b/c/d/df truncate -s 1000G a/b/c/d/e/ee echo blah >> a/b/c/d/e/ee echo foobar > a/aa echo quuz > a/b/bb echo baz >> a/aa cd .. fsync "$device" & rm -r testcrap done where device and dir are set to the device that has softupdates on it and dir where the fs is mounted. In a minute or so, the machine will panic.. >Fix: turning off softupdates on the fs should prevent the panic since the code path will no longer run... Though since it can happen on any softdep enabled fs, you should turn off softdep on all fs's on the box... the following patch is known to remove the panic, but is unknown if it correct.. It could introduce a race where on disk meta data is not correct breaking softdep's assumptions upon crash: Index: ffs_softdep.c =================================================================== RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_softdep.c,v retrieving revision 1.57.2.12 diff -u -r1.57.2.12 ffs_softdep.c --- ffs_softdep.c 2004/03/15 18:04:41 1.57.2.12 +++ ffs_softdep.c 2004/05/17 22:53:54 @@ -4250,7 +4250,7 @@ * rather than panic, just flush it. */ nbp = WK_BMSAFEMAP(wk)->sm_buf; - if (getdirtybuf(&nbp, waitfor) == 0) + if (getdirtybuf(&nbp, MNT_NOWAIT) == 0) break; FREE_LOCK(&lk); if (waitfor == MNT_NOWAIT) { >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405172255.i4HMtIjS054126>