Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Feb 2006 14:56:01 -0500
From:      Kris Kennaway <kris@obsecurity.org>
To:        stable@FreeBSD.org
Subject:   Patch for quota deadlock
Message-ID:  <20060221195601.GA63134@xor.obsecurity.org>

next in thread | raw e-mail | index | archive | help

--BOKacYhQ+x31HxR3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Jeff has been too busy to send this patch himself, but it fixed the
quota deadlock that I was able to provoke on my machine.  Does it also
solve the issue for others?

Kris

----- Forwarded message from Jeff Roberson <jroberson@chesapeake.net> -----

X-Original-To: kkenn@localhost
Delivered-To: kkenn@localhost.obsecurity.org
X-Original-To: kris@FreeBSD.org
Delivered-To: kris@FreeBSD.org
Date: Wed, 15 Feb 2006 17:46:31 -0800 (PST)
From: Jeff Roberson <jroberson@chesapeake.net>
X-X-Sender: jroberson@10.0.0.1
To: Kris Kennaway <kris@obsecurity.org>
cc: ssouhlal@FreeBSD.org, kan@FreeBSD.org
Subject: Re: Quota deadlock
In-Reply-To: <20060215081545.GA18583@xor.obsecurity.org>
X-Scanned-By: MIMEDefang 2.52 on 216.240.101.25
X-UIDL: L0D!!!H0!!'W+"!=3Dh9"!
X-Bogosity: Ham, tests=3Dbogofilter, spamicity=3D0.000000, version=3D1.0.1

Please try this patch.  LK_NOWAIT is causing qsync() to spin forever.

Index: ufs_quota.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/ufs/ufs/ufs_quota.c,v
retrieving revision 1.79
diff -u -r1.79 ufs_quota.c
--- ufs_quota.c 12 Feb 2006 13:20:06 -0000      1.79
+++ ufs_quota.c 16 Feb 2006 01:45:56 -0000
@@ -750,7 +750,7 @@
                        MNT_ILOCK(mp);
                        continue;
                }
-               error =3D vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK,=
=20
td);
+               error =3D vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td);
                if (error) {
                        MNT_ILOCK(mp);
                        if (error =3D=3D ENOENT) {


On Wed, 15 Feb 2006, Kris Kennaway wrote:

>Quotas are enabled on this machine:
>
>db> show lockedvnods
>Locked vnodes
>
>0xc6be4a80: tag ufs, type VREG
>   usecount 0, writecount 0, refcount 3 mountedhere 0
>   flags ()
>   v_object 0xc6bf4d98 ref 0 pages 2
>    lock type ufs: EXCL (count 1) by thread 0xcb814000 (pid 2031)#0=20
>    0xc0504d12 at lockmgr+0x55a
>#1 0xc056f19b at vop_stdlock+0x32
>#2 0xc06cffde at VOP_LOCK_APV+0xa6
>#3 0xc063d775 at ffs_lock+0x19
>#4 0xc06cffde at VOP_LOCK_APV+0xa6
>#5 0xc0587b58 at vn_lock+0xd3
>#6 0xc0586d5e at vn_close+0x7c
>#7 0xc0587cd1 at vn_closefile+0xf0
>#8 0xc04efc78 at fdrop_locked+0xb9
>#9 0xc04efbb9 at fdrop+0x3c
>#10 0xc04ee0ac at closef+0x428
>#11 0xc04eaf7c at close+0x245
>#12 0xc06b7359 at syscall+0x2e9
>#13 0xc06a140f at Xint0x80_syscall+0x1f
>
>       ino 23557, on dev da0s1a
>
>0xc7610540: tag ufs, type VDIR
>   usecount 1, writecount 0, refcount 4 mountedhere 0
>   flags ()
>   v_object 0xc9fb6078 ref 0 pages 1
>    lock type ufs: EXCL (count 1) by thread 0xcb8b2d00 (pid 2001)#0=20
>    0xc0504d12 at lockmgr+0x55a
>#1 0xc056f19b at vop_stdlock+0x32
>#2 0xc06cffde at VOP_LOCK_APV+0xa6
>#3 0xc063d775 at ffs_lock+0x19
>#4 0xc06cffde at VOP_LOCK_APV+0xa6
>#5 0xc0587b58 at vn_lock+0xd3
>#6 0xc057981f at vget+0xf0
>#7 0xc056c22f at cache_lookup+0x3d0
>#8 0xc056c8f6 at vfs_cache_lookup+0xa4
>#9 0xc06cd997 at VOP_LOOKUP_APV+0xa6
>#10 0xc057163b at lookup+0x47a
>#11 0xc0570efa at namei+0x431
>#12 0xc057cf38 at kern_statfs+0x6d
>#13 0xc057cea5 at statfs+0x35
>#14 0xc06b7359 at syscall+0x2e9
>#15 0xc06a140f at Xint0x80_syscall+0x1f
>
>       ino 1492256, on dev da0s1e
>VNASSERT failed
>0xcac88200: tag (null), type VMARKER
>   usecount 0, writecount 0, refcount 0 mountedhere 0
>   flags ()
>
>The only process running is umount:
>
>db> wh 2030
>Tracing pid 2030 tid 100176 td 0xcbaa41a0
>cpustop_handler(e8ef9a10,c06b648f,e8ef9998,e8ef9998,cbaa41a0) at=20
>cpustop_handler+0x2c
>ipi_nmi_handler(e8ef9998,e8ef9998,cbaa41a0,e8ef99a4,46) at=20
>ipi_nmi_handler+0x29
>trap(e8ef0008,e8ef0028,c06a0028,50,0) at trap+0x3f
>calltrap() at calltrap+0x5
>--- trap 0x13, eip =3D 0xc0504794, esp =3D 0xe8ef9a58, ebp =3D 0xe8ef9a78 =
---
>acquire(e8ef9afc,50,1050000,b2,cbaa41a0) at acquire+0x124
>lockmgr(cd6bd838,2012,cd6bd8a8,cbaa41a0,e8ef9b28) at lockmgr+0x4df
>vop_stdlock(e8ef9b7c,c063c186,c057cc44,c0742080,e8ef9b7c) at=20
>vop_stdlock+0x32
>VOP_LOCK_APV(c07425c0,e8ef9b7c,e8ef9b54,c06cffde,e8ef9b7c) at=20
>VOP_LOCK_APV+0xa6
>ffs_lock(e8ef9b7c,ce51a758,87f,2012,cd6bd7e0) at ffs_lock+0x19
>VOP_LOCK_APV(c0742080,e8ef9b7c,138,ce51a690,ce51a690) at VOP_LOCK_APV+0xa6
>vn_lock(cd6bd7e0,2012,cbaa41a0,79d,2012) at vn_lock+0xd3
>vget(cd6bd7e0,2012,cbaa41a0,2ea,c6823488) at vget+0xf0
>qsync(c6823400,0,c070ad43,490,c6823488) at qsync+0x13e
>ffs_sync(c6823400,2,cbaa41a0,cbaa41a0,c6823400) at ffs_sync+0x2e0
>sync(cbaa41a0,e8ef9d04,cbaa41a0,cbaa41a0,c7a57108) at sync+0x100
>syscall(3b,3b,3b,2,bfbfe958) at syscall+0x2e9
>Xint0x80_syscall() at Xint0x80_syscall+0x1f
>--- syscall (36, FreeBSD ELF32, sync), eip =3D 0x280c260f, esp =3D 0xbfbfe=
8ac,=20
>ebp =3D 0xbfbfe918 ---
>db>


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

--BOKacYhQ+x31HxR3
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFD+3BRWry0BWjoQKURAptzAKDDTlcHmyOmUrv+ND1uveJW9nRVXACgpXEH
/VpzQF2CZznOMF/IIhrd5SQ=
=iz/h
-----END PGP SIGNATURE-----

--BOKacYhQ+x31HxR3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060221195601.GA63134>