[jmg at FreeBSD.org: kern/66781: softupdate code causes panic]

Xin LI delphij at frontfree.net
Mon May 17 20:35:44 PDT 2004


FYI, I noticed that DragonFly has same code so maybe the same problem
applies. I have confirmed this on my FreeBSD 4.10-RC box, but not sure
about DF because I have to go home before I can get access to a DF box :-)

Cheers,

----- Forwarded message from John-Mark Gurney <jmg at xxxxxxxxxxx> -----

>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 at xxxxxxxxxxxxxxxxxxxx:/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:
_______________________________________________
freebsd-bugs at xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe at xxxxxxxxxxx"


----- End forwarded message -----

-- 
Xin LI <delphij frontfree net>	http://www.delphij.net/
See complete headers for GPG key and other information.

Attachment:
pgp00003.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00003.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20040517/8f0316fa/attachment-0016.obj>


More information about the Submit mailing list