DragonFly BSD
DragonFly submit List (threaded) for 2004-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

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

From: Xin LI <delphij@xxxxxxxxxxxxx>
Date: Tue, 18 May 2004 11:34:35 +0800

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 :-)


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

>Number:         66781
>Category:       kern
>Synopsis:       softupdate code causes panic
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 17 16:00:30 PDT 2004
>Originator:     John-Mark Gurney
>Release:        FreeBSD RELENG_4
Cu Networking
System: FreeBSD freefall.freebsd.org 4.10-RC FreeBSD 4.10-RC #12: Sun Apr 25 14:35:16 PDT 2004 kensmith@xxxxxxxxxxxxxxxxxxxx:/c/src/sys/compile/FREEFALL i386

	any -stable box with softupdates enabled on a file system.


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.

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.

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

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

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
diff -u -r1.57.2.12 ffs_softdep.c
--- ffs_softdep.c	2004/03/15 18:04:41
+++ 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)
 			if (waitfor == MNT_NOWAIT) {
freebsd-bugs@xxxxxxxxxxx mailing list
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@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
Description: PGP signature

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]