Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Apr 2006 18:39:09 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Dmitry Morozovsky <marck@rinet.ru>
Cc:        stable@freebsd.org, Kris Kennaway <kris@obsecurity.org>
Subject:   Re: fsck_ufs locked in snaplk
Message-ID:  <20060425153909.GE1446@deviant.kiev.zoral.com.ua>
In-Reply-To: <20060425185741.C71240@woozle.rinet.ru>
References:  <20060424181531.GA13774@xor.obsecurity.org> <20060425001751.S44618@woozle.rinet.ru> <20060424202859.GA18457@xor.obsecurity.org> <20060425004405.G44618@woozle.rinet.ru> <20060424205026.GA18844@xor.obsecurity.org> <20060425134418.J57625@woozle.rinet.ru> <20060425080932.1rv9hq0rcws4wc84@www.wolves.k12.mo.us> <20060425133532.GD1446@deviant.kiev.zoral.com.ua> <20060425095610.ibv24kg1kw00s040@www.wolves.k12.mo.us> <20060425185741.C71240@woozle.rinet.ru>

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

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

On Tue, Apr 25, 2006 at 07:06:11PM +0400, Dmitry Morozovsky wrote:
> On Tue, 25 Apr 2006, Chris Dillon wrote:
>=20
> CD> > Please, also add DDB to the kernel and show the result of the
> CD> > show lockedvnodes
> CD> > alltrace
> CD> > ps
> CD> > in the DDB after the deadlock, as asked by Kris Kennaway earlier
> CD> > in this thread !
> CD> >=20
> CD>=20
> CD> OK, I've added DDB, but all of the information I might gather I'll ha=
ve to
> CD> write down by hand since I have no serial console access. :-(
>=20
> I just made lab machine with serial console, compile minimal kernel with =
quotas=20
> and KDB+WITNESS, and immediately after ``quotacheck /var && quotaon /var'=
' got
>=20
> kdb_backtrace(d663aba0,c051f402,c05f7da3,c05fe731,c32cb414) at=20
> kdb_backtrace+0x29
> vfs_badlock(c05f7da3,c05fe731,c32cb414) at vfs_badlock+0x11
> assert_vop_locked(c32cb414,c05fe731,c30ed400,c04eac2c,c05f6cf4) at=20
> assert_vop_locked+0x4a
> quotaon(c30c5300,c3069c00,0,804a3e0,0) at quotaon+0x166
> ufs_quotactl(c3069c00,10000,0,804a3e0,c30c5300) at ufs_quotactl+0xb9
> quotactl(c30c5300,d663ad04,4,1,206) at quotactl+0xf8
> syscall(3b,3b,3b,8048fa8,2813cccc) at syscall+0x22f
> Xint0x80_syscall() at Xint0x80_syscall+0x1f
> --- syscall (148, FreeBSD ELF32, quotactl), eip =3D 0x280b694b, esp =3D 0=
xbfbfebcc,=20
> ebp =3D 0xbfbfebf8 ---
> quotaon: 0xc32cb414 is not locked but should be
> KDB: enter: lock violation
>=20
> full console log after dropping to ddb is available (40k) at
>=20
> http://woozle.net/FreeBSD/debug/kdb-quota-20060425.txt
>=20
Obviously, revisions 1.78, 1.79 of the sys/ufs/ufs/ufs_quota.c
shall be MFCed. Try this patch (note, I does not tested it):


Index: sys/ufs/ufs/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: /usr/local/arch/ncvs/src/sys/ufs/ufs/ufs_quota.c,v
retrieving revision 1.77
retrieving revision 1.79
diff -u -r1.77 -r1.79
--- sys/ufs/ufs/ufs_quota.c	9 Jan 2006 20:42:19 -0000	1.77
+++ sys/ufs/ufs/ufs_quota.c	12 Feb 2006 13:20:06 -0000	1.79
@@ -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]);



--kvUQC+jR9YzypDnK
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQFETkKcC3+MBN1Mb4gRAkKDAKCQmkEnUuITf1foRicikriqineXkwCfW+cC
j8PE0jvW140W3Wh6yei6cu8=
=Dqyl
-----END PGP SIGNATURE-----

--kvUQC+jR9YzypDnK--



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