From owner-freebsd-stable@FreeBSD.ORG Wed Apr 26 13:36:29 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 BA8E516A404 for ; Wed, 26 Apr 2006 13:36:29 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from fw.zoral.com.ua (ll-227.216.82.212.sovam.net.ua [212.82.216.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77CE343D45 for ; Wed, 26 Apr 2006 13:36:27 +0000 (GMT) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by fw.zoral.com.ua (8.13.4/8.13.4) with ESMTP id k3QDaH3K032445 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 26 Apr 2006 16:36:18 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.13.6/8.13.6) with ESMTP id k3QDaH0g021309; Wed, 26 Apr 2006 16:36:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.13.6/8.13.6/Submit) id k3QDaHL9021308; Wed, 26 Apr 2006 16:36:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 26 Apr 2006 16:36:17 +0300 From: Kostik Belousov To: Dmitry Morozovsky Message-ID: <20060426133617.GG1446@deviant.kiev.zoral.com.ua> References: <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> <20060425153909.GE1446@deviant.kiev.zoral.com.ua> <20060425162252.GA54244@xor.obsecurity.org> <444EC8EA.8050305@asd.aplus.net> <20060426011703.GA61794@xor.obsecurity.org> <20060426134217.C93749@woozle.rinet.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XStn23h1fwudRqtG" Content-Disposition: inline In-Reply-To: <20060426134217.C93749@woozle.rinet.ru> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: ClamAV version 0.88.1, clamav-milter version 0.88.1 on fw.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on fw.zoral.com.ua Cc: freebsd-stable@freebsd.org, Kris Kennaway Subject: Re: fsck_ufs locked in snaplk 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: Wed, 26 Apr 2006 13:36:29 -0000 --XStn23h1fwudRqtG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 26, 2006 at 01:43:42PM +0400, Dmitry Morozovsky wrote: > On Tue, 25 Apr 2006, Kris Kennaway wrote: >=20 > KK> What people are seeing now must be some other problem that I wan't > KK> able to reproduce. > KK>=20 > KK> Once I hear back from someone who can reproduce it with debugging > KK> enabled (I'm also trying) we can try to fix it. >=20 > Please try to simulate user who is over soft quota and is out of grace pe= riod.=20 > I'm trying to do so as well, but currently quite busy with other tasks :( I'm not sure whether the following is the issue you met, but: dqsync from sys/ufs/ufs/ufs_quota.c calls vn_start_secondary_write() unconditionally. As result, mp->mnt_secondary_accwrites counter from the struct mount will always increase after the entry to the dqsync. ffs_snapshot calls ffs_sync, that calls dsync, that iterates over vnodes and calls dqsync on them. And, after the qsync, ffs_sync checks whether mp->mnt_secondary_accwrites changes by calling softdep_check_suspend (see line 1221 of ffs_vfsops.c). If changed, ffs_sync would restart the syncing loop, that never finishes. This is very strange, since if true, it basicaly means that snapshots and quotas shall lead to immediate deadlock ... The following patch moves call to vn_start_secondary_write after check for DQ_MOD. Please, try 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.81 diff -u -r1.81 ufs_quota.c --- sys/ufs/ufs/ufs_quota.c 8 Mar 2006 23:43:39 -0000 1.81 +++ sys/ufs/ufs/ufs_quota.c 26 Apr 2006 13:34:33 -0000 @@ -989,19 +989,16 @@ return (0); if ((dqvp =3D dq->dq_ump->um_quotas[dq->dq_type]) =3D=3D NULLVP) panic("dqsync: file"); - (void) vn_start_secondary_write(dqvp, &mp, V_WAIT); - if (vp !=3D dqvp) - vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY, td); while (dq->dq_flags & DQ_LOCK) { dq->dq_flags |=3D DQ_WANT; (void) tsleep(dq, PINOD+2, "dqsync", 0); if ((dq->dq_flags & DQ_MOD) =3D=3D 0) { - if (vp !=3D dqvp) - VOP_UNLOCK(dqvp, 0, td); - vn_finished_secondary_write(mp); return (0); } } + (void) vn_start_secondary_write(dqvp, &mp, V_WAIT); + if (vp !=3D dqvp) + vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY, td); dq->dq_flags |=3D DQ_LOCK; auio.uio_iov =3D &aiov; auio.uio_iovcnt =3D 1; --XStn23h1fwudRqtG Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (FreeBSD) iD8DBQFET3dQC3+MBN1Mb4gRArjkAJ9V15K8U2/3vsFOqaXY4iDDzDq2iACgsvmf D6rp8CmJh9PEnielXxx/gzo= =i1oT -----END PGP SIGNATURE----- --XStn23h1fwudRqtG--