From owner-svn-src-head@FreeBSD.ORG Thu Aug 4 22:49:40 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D87F31065673; Thu, 4 Aug 2011 22:49:40 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) by mx1.freebsd.org (Postfix) with ESMTP id B7B798FC08; Thu, 4 Aug 2011 22:49:40 +0000 (UTC) Received: from delta.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 846A7152D0; Thu, 4 Aug 2011 15:49:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1312498180; bh=G56q0X3+gs1axL5FzKye8jAf8g0Sq0w4I7MqYVUxeBk=; h=Message-ID:Date:From:Reply-To:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type; b=4SvfQQMabFWPz7MW6b33700+Y2k4/SOzEgjSZ6mdw1Ajdk1kfg3thtAXVLXQ36kc/ ZULut3rKzFcER3u2WJCYrATBGSoep/yF4ZdZ32HE2bdwN/5bgdoROmr/SHxXwIksL0 d8uv7tN2Sz/BSRcAcMrDsI2DZ34QItjoWzqiTgZ4= Message-ID: <4E3B2202.30205@delphij.net> Date: Thu, 04 Aug 2011 15:49:38 -0700 From: Xin LI Organization: The FreeBSD Project MIME-Version: 1.0 To: Jung-uk Kim References: <201108021913.p72JDun2064946@svn.freebsd.org> <201108041746.47551.jkim@FreeBSD.org> In-Reply-To: <201108041746.47551.jkim@FreeBSD.org> OpenPGP: id=3FCA37C1; url=http://www.delphij.net/delphij.asc Content-Type: multipart/mixed; boundary="------------020907050005030601080603" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@FreeBSD.org, Martin Matuska Subject: Re: svn commit: r224614 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2011 22:49:41 -0000 This is a multi-part message in MIME format. --------------020907050005030601080603 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 08/04/11 14:46, Jung-uk Kim wrote: > On Tuesday 02 August 2011 03:13 pm, Martin Matuska wrote: >> Author: mm Date: Tue Aug 2 19:13:56 2011 New Revision: 224614 URL: >> http://svn.freebsd.org/changeset/base/224614 >> >> Log: For mount, discover f_mntonname from supplied path argument >> using vn_fullpath_global(). This fixes f_mntonname if mounting >> inside chroot, jail or with relative path as argument. >> >> For unmount in jail, use vn_fullpath_global() to discover global >> path from supplied path argument. This fixes unmount in jail. > > It seems fdescfs(5) hangs after this commit if the mount point is > /dev/fd. Please find attached kib@'s patch that fixes this issue (david wolfskill and I have both tested individually). Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iQEcBAEBCAAGBQJOOyIBAAoJEATO+BI/yjfB7TAIAMHOQVpyZf8ZwayvMQ0Dnl5L N9c+ttuSDTlrIApj20Hz8Ezp1Z+u91euwhGizXq61F5KBmD2J1CmjNXIsanLlRn5 DXebrls7KRLwqRAPf6HciIaU8G0d9ktP1Z3cHDRgLbc43cEEJHHi5WuMREtENTF2 RUkQwh8m7PTlzFnyIGVnamTkpF9AC2xK4XSlrdVSn+tEWFMVXPWo8EIvh1vJRwZ3 CKCF/aLyVC/DD2LAi9IWHIx4MQ4x9LoQFzBiOzkhhv63JmL0hd8E6GNei6VQS/yK rQ+Td8YEwOVttpXF62CiNarYzKmOoMhJ3oaKt922V6uoxIXh3/Dh4xSXt/ZDxV0= =q2uo -----END PGP SIGNATURE----- --------------020907050005030601080603 Content-Type: text/plain; name="kib-vfs_mount.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kib-vfs_mount.c.diff" Index: sys/kern/vfs_mount.c =================================================================== --- sys/kern/vfs_mount.c (revision 224652) +++ sys/kern/vfs_mount.c (working copy) @@ -746,13 +746,15 @@ vfs_domount_first( struct thread *td, /* Calling thread. */ struct vfsconf *vfsp, /* File system type. */ struct vnode *vp, /* Vnode to be covered. */ + char *ufspath, int fsflags, /* Flags common to all filesystems. */ struct vfsoptlist **optlist /* Options local to the filesystem. */ ) { struct vattr va; + struct nameidata nd; struct mount *mp; - struct vnode *newdp; + struct vnode *newdp, *vp1; char *fspath, *fbuf; int error; @@ -761,18 +763,47 @@ vfs_domount_first( KASSERT((fsflags & MNT_UPDATE) == 0, ("MNT_UPDATE shouldn't be here")); /* Construct global filesystem path from vp. */ + VOP_UNLOCK(vp, 0); error = vn_fullpath_global(td, vp, &fspath, &fbuf); if (error != 0) { - vput(vp); + vrele(vp); return (error); } if (strlen(fspath) >= MNAMELEN) { - vput(vp); + vrele(vp); free(fbuf, M_TEMP); return (ENAMETOOLONG); } + if ((vp->v_iflag & VI_DOOMED) != 0) { + vrele(vp); + free(fbuf, M_TEMP); + return (EBADF); + } /* + * Re-lookup the vnode by path. As a side effect, the vnode is + * relocked. If vnode was renamed, return ENOENT. + */ + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, + UIO_SYSSPACE, ufspath, td); + error = namei(&nd); + if (error != 0) { + vrele(vp); + free(fbuf, M_TEMP); + return (error); + } + if (NDHASGIANT(&nd)) + mtx_unlock(&Giant); + NDFREE(&nd, NDF_ONLY_PNBUF); + vp1 = nd.ni_vp; + vrele(vp); + if (vp1 != vp) { + vput(vp1); + free(fbuf, M_TEMP); + return (ENOENT); + } + + /* * If the user is not root, ensure that they own the directory * onto which we are attempting to mount. */ @@ -1084,14 +1115,11 @@ vfs_domount( NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; if ((fsflags & MNT_UPDATE) == 0) - error = vfs_domount_first(td, vfsp, vp, fsflags, optlist); + error = vfs_domount_first(td, vfsp, vp, fspath, fsflags, optlist); else error = vfs_domount_update(td, vp, fsflags, optlist); mtx_unlock(&Giant); - ASSERT_VI_UNLOCKED(vp, __func__); - ASSERT_VOP_UNLOCKED(vp, __func__); - return (error); } --------------020907050005030601080603--