From owner-freebsd-fs@FreeBSD.ORG Mon Apr 23 14:34:45 2007 Return-Path: X-Original-To: freebsd-fs@freebsd.org Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7E3C716A403; Mon, 23 Apr 2007 14:34:45 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from gnome.kiev.sovam.com (gnome.kiev.sovam.com [212.109.32.24]) by mx1.freebsd.org (Postfix) with ESMTP id 121C113C448; Mon, 23 Apr 2007 14:34:44 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com ([62.64.120.197]) by gnome.kiev.sovam.com with esmtp (Exim 4.60) (envelope-from ) id 1Hfzcp-000BTZ-MD; Mon, 23 Apr 2007 17:34:43 +0300 Received: from [212.82.216.227] (helo=fw.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.60) (envelope-from ) id 1Hfydl-0000Qn-P7; Mon, 23 Apr 2007 16:31:40 +0300 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 l3NDVWDS030224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 23 Apr 2007 16:31:32 +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.14.1/8.14.1) with ESMTP id l3NDVVf2032755; Mon, 23 Apr 2007 16:31:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id l3NDVVFp032754; Mon, 23 Apr 2007 16:31:31 +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: Mon, 23 Apr 2007 16:31:31 +0300 From: Kostik Belousov To: Maxim Sobolev Message-ID: <20070423133131.GA32370@deviant.kiev.zoral.com.ua> References: <46296E0F.2070202@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ew6BAiZeqk4r7MaW" Content-Disposition: inline In-Reply-To: <46296E0F.2070202@FreeBSD.org> User-Agent: Mutt/1.4.2.2i X-Virus-Scanned: ClamAV version 0.88.7, clamav-milter version 0.88.7 on fw.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-0.1 required=5.0 tests=ALL_TRUSTED,SPF_NEUTRAL autolearn=failed version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on fw.zoral.com.ua X-Scanner-Signature: efe3bc1504fa577d936f03857ce6b673 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Info: Profiles 972 [Apr 23 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {received from trusted relay: not dialup} X-SpamTest-Method: none X-SpamTest-Method: Local Lists X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release X-Delayed: more then 1h on relay02.kiev.sovam.com Cc: freebsd-fs@freebsd.org, "current@freebsd.org" Subject: Re: Bug in the unmounting code X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Apr 2007 14:34:45 -0000 --ew6BAiZeqk4r7MaW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 20, 2007 at 06:51:11PM -0700, Maxim Sobolev wrote: > Hi, >=20 > I have noticed that there is a bug in unmounting code which could make > filesystem unmountable when its parent filesystem has been forcefully > unmounted. Following is quick way to reproduce the problem: >=20 > [sobomax@pioneer ~]$ sudo mkdir -p /tmp/1/2 > [sobomax@pioneer ~]$ sudo mkdir /tmp/3 > [sobomax@pioneer ~]$ sudo mount_nullfs /tmp/1 /tmp/3 > [sobomax@pioneer ~]$ sudo mount_nullfs /tmp/1 /tmp/3/2 > [sobomax@pioneer ~]$ sudo umount -f /tmp/3 > [sobomax@pioneer ~]$ sudo mount -v > /tmp/1 on /tmp/3/2 (nullfs, local, fsid 03ff000202000000) > [sobomax@pioneer ~]$ sudo umount 03ff000202000000 > umount: unmount of /tmp/3/2 failed: No such file or directory > umount: retrying using path instead of file system ID > umount: unmount of /tmp/3/2 failed: No such file or directory >=20 > Investigation has revealed that in this case vn_lock() call fails with > ENOENT due to the following piece of code: >=20 > vn_lock() > [...] > if (error =3D=3D 0 && vp->v_iflag & VI_DOOMED && > (flags & LK_RETRY) =3D=3D 0) { > VOP_UNLOCK(vp, 0, td); > error =3D ENOENT; > break; > } > [...] >=20 > Addition of LK_RETRY flag fixed the problem, but my knowledge of VFS is > quite limited so that I would appreciate if somebody could verify that > the fix below won't have any undesirable effects. >=20 > -Maxim >=20 > --- vfs_mount.c 2007/04/21 01:40:53 1.1 > +++ vfs_mount.c 2007/04/21 01:41:09 > @@ -1155,7 +1155,7 @@ > mnt_gen_r =3D mp->mnt_gen; > VI_LOCK(coveredvp); > vholdl(coveredvp); > - error =3D vn_lock(coveredvp, LK_EXCLUSIVE | LK_INTERLOCK,= td); > + error =3D vn_lock(coveredvp, LK_EXCLUSIVE | LK_INTERLOCK | > LK_RETRY, td); > vdrop(coveredvp); > /* > * Check for mp being unmounted while waiting for the Thank you for tracking this. The regression was introduced by me in rev. 1.= 232. There is no need to check for error after vn_lock(LK_RETRY). --ew6BAiZeqk4r7MaW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFGLLUyC3+MBN1Mb4gRAigiAJ4ovfbYuVXBz7wvEbaSxukjE+NT8wCeIqsn 51dI3qp7BJEh29npBaD9ih0= =825B -----END PGP SIGNATURE----- --ew6BAiZeqk4r7MaW--