From owner-freebsd-stable@FreeBSD.ORG Tue Feb 28 10:03:22 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4851B16A420 for ; Tue, 28 Feb 2006 10:03:22 +0000 (GMT) (envelope-from kris@obsecurity.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id ECE7243D6D for ; Tue, 28 Feb 2006 10:03:21 +0000 (GMT) (envelope-from kris@obsecurity.org) Received: from obsecurity.dyndns.org (elvis.mu.org [192.203.228.196]) by elvis.mu.org (Postfix) with ESMTP id 7FB841A4E50; Tue, 28 Feb 2006 02:03:21 -0800 (PST) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id A50AF53664; Tue, 28 Feb 2006 05:03:20 -0500 (EST) Date: Tue, 28 Feb 2006 05:03:20 -0500 From: Kris Kennaway To: Kris Kennaway Message-ID: <20060228100320.GA56232@xor.obsecurity.org> References: <20060221195601.GA63134@xor.obsecurity.org> <20060228074037.GE21678@e-Gitt.NET> <20060228075139.GA38928@xor.obsecurity.org> <200602281158.03030.nike_d@cytexbg.com> <20060228100040.GA56094@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tThc/1wpZn/ma/RB" Content-Disposition: inline In-Reply-To: <20060228100040.GA56094@xor.obsecurity.org> User-Agent: Mutt/1.4.2.1i Cc: freebsd-stable@freebsd.org Subject: Re: Patch for quota deadlock X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Feb 2006 10:03:22 -0000 --tThc/1wpZn/ma/RB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 > >=20 > > I'm jumping here from the [snaphost timestamps] thread. > >=20 > > Here is what happened when i compiled the kernel with QUOTAS enabled,= =20 > > enable_quotas=3D"YES" in rc.conf, and LK_NOWAIT patch applied : >=20 > > 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 =3D 0x80068671c, rsp = =3D=20 >=20 > Thanks, I forgot about this. You'll need these patches too: >=20 > http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/ufs/ufs/ufs_quota.c.diff?r1= =3D1.77&r2=3D1.78 > http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/ufs/ufs/ufs_quota.c.diff?r1= =3D1.78&r2=3D1.79 Here is the combined patch, without the $FreeBSD$ bits that won't apply on RELENG_6: 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.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] |=3D QTF_OPENING; mp->mnt_flag |=3D MNT_QUOTA; - ASSERT_VOP_LOCKED(vp, "quotaon"); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); vp->v_vflag |=3D VV_SYSTEM; + VOP_UNLOCK(vp, 0, td); *vpp =3D 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 &=3D ~VV_SYSTEM; + VOP_UNLOCK(qvp, 0, td); error =3D vn_close(qvp, FREAD|FWRITE, td->td_ucred, td); ump->um_quotas[type] =3D NULLVP; crfree(ump->um_cred[type]); @@ -748,7 +750,7 @@ MNT_ILOCK(mp); continue; } - error =3D vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, td); + error =3D vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td); if (error) { MNT_ILOCK(mp); if (error =3D=3D ENOENT) { --tThc/1wpZn/ma/RB Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (FreeBSD) iD8DBQFEBB/oWry0BWjoQKURAgcTAKDvNpc9ZvjGVUWrNlee5809WQHpuQCgz7a9 4vWukcNZSDjQPEFM4M6lrw0= =GIiz -----END PGP SIGNATURE----- --tThc/1wpZn/ma/RB--