Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756826Ab0GGPR5 (ORCPT ); Wed, 7 Jul 2010 11:17:57 -0400 Received: from cantor.suse.de ([195.135.220.2]:43751 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752438Ab0GGPR4 (ORCPT ); Wed, 7 Jul 2010 11:17:56 -0400 Date: Thu, 8 Jul 2010 01:17:38 +1000 From: Nick Piggin To: "Aneesh Kumar K.V" Cc: hch@infradead.org, viro@zeniv.linux.org.uk, adilger@sun.com, corbet@lwn.net, serue@us.ibm.com, neilb@suse.de, hooanon05@yahoo.co.jp, bfields@fieldses.org, linux-fsdevel@vger.kernel.org, sfrench@us.ibm.com, philippe.deniel@CEA.FR, linux-kernel@vger.kernel.org Subject: Re: [PATCH -V14 03/11] vfs: Add open by file handle support Message-ID: <20100707151738.GR11732@laptop> References: <1276621981-2774-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1276621981-2774-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1276621981-2774-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1214 Lines: 42 On Tue, Jun 15, 2010 at 10:42:53PM +0530, Aneesh Kumar K.V wrote: > diff --git a/fs/open.c b/fs/open.c > index 43ac798..1c5daa3 100644 > --- a/fs/open.c > +++ b/fs/open.c > @@ -1168,3 +1168,201 @@ SYSCALL_DEFINE4(name_to_handle_at, int, dfd, const char __user *, name, > return -ENOSYS; > } > #endif > + > +#ifdef CONFIG_EXPORTFS > +static struct vfsmount *get_vfsmount_from_fd(int fd) > +{ > + int fput_needed; > + struct path *path; > + struct file *filep; > + > + if (fd == AT_FDCWD) { > + struct fs_struct *fs = current->fs; > + read_lock(&fs->lock); > + path = &fs->pwd; > + mntget(path->mnt); > + read_unlock(&fs->lock); > + } else { > + filep = fget_light(fd, &fput_needed); > + if (!filep) > + return ERR_PTR(-EBADF); > + path = &filep->f_path; > + mntget(path->mnt); > + fput_light(filep, fput_needed); > + } > + return path->mnt; > +} The bulk of this this should probably be in fs/namei.c, factored with path_init stuff if possible please. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/