Patch for quota deadlock
Kris Kennaway
kris at obsecurity.org
Tue Feb 28 02:03:22 PST 2006
On Tue, Feb 28, 2006 at 05:00:40AM -0500, Kris Kennaway wrote:
> On Tue, Feb 28, 2006 at 11:58:02AM +0200, Niki Denev wrote:
> > On Tuesday 28 February 2006 09:51, Kris Kennaway wrote:
> > > On Tue, Feb 28, 2006 at 08:40:37AM +0100, Oliver Brandmueller wrote:
> > > > Anyway, I'll discuss with my colleagues and we'll see if we want to take
> > > > the risk.
> > >
> > > Thanks, it would be a big help if you're willing to try.
> > >
> > > Kris
> >
> > I'm jumping here from the [snaphost timestamps] thread.
> >
> > Here is what happened when i compiled the kernel with QUOTAS enabled,
> > enable_quotas="YES" in rc.conf, and LK_NOWAIT patch applied :
>
> > Enabling quotas:KDB: stack backtrace:
> > vfs_badlock() at vfs_badlock+0x95
> > assert_vop_locked() at assert_vop_locked+0x77
> > quotaon() at quotaon+0x182
> > ufs_quotactl() at ufs_quotactl+0x150
> > quotactl() at quotactl+0x15c
> > syscall() at syscall+0x642
> > Xfast_syscall() at Xfast_syscall+0xa8
> > --- syscall (148, FreeBSD ELF64, quotactl), rip = 0x80068671c, rsp =
>
> Thanks, I forgot about this. You'll need these patches too:
>
> http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/ufs/ufs/ufs_quota.c.diff?r1=1.77&r2=1.78
> http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/ufs/ufs/ufs_quota.c.diff?r1=1.78&r2=1.79
Here is the combined patch, without the $FreeBSD$ bits that won't
apply on RELENG_6:
Index: ufs_quota.c
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ufs/ufs_quota.c,v
retrieving revision 1.77
retrieving revision 1.80
diff -u -u -r1.77 -r1.80
--- ufs_quota.c 9 Jan 2006 20:42:19 -0000 1.77
+++ ufs_quota.c 22 Feb 2006 06:12:53 -0000 1.80
@@ -429,8 +429,9 @@
quotaoff(td, mp, type);
ump->um_qflags[type] |= QTF_OPENING;
mp->mnt_flag |= MNT_QUOTA;
- ASSERT_VOP_LOCKED(vp, "quotaon");
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
vp->v_vflag |= VV_SYSTEM;
+ VOP_UNLOCK(vp, 0, td);
*vpp = vp;
/*
* Save the credential of the process that turned on quotas.
@@ -535,8 +536,9 @@
}
MNT_IUNLOCK(mp);
dqflush(qvp);
- ASSERT_VOP_LOCKED(qvp, "quotaoff");
+ vn_lock(qvp, LK_EXCLUSIVE | LK_RETRY, td);
qvp->v_vflag &= ~VV_SYSTEM;
+ VOP_UNLOCK(qvp, 0, td);
error = vn_close(qvp, FREAD|FWRITE, td->td_ucred, td);
ump->um_quotas[type] = NULLVP;
crfree(ump->um_cred[type]);
@@ -748,7 +750,7 @@
MNT_ILOCK(mp);
continue;
}
- error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, td);
+ error = vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td);
if (error) {
MNT_ILOCK(mp);
if (error == ENOENT) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20060228/f2ba4688/attachment.bin
More information about the freebsd-stable
mailing list