linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Trond Myklebust
	<Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>
Cc: Linus Torvalds
	<torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
	Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 5/5] NFS: Correct the NFS mount path when following a referral
Date: Tue, 23 Jun 2009 15:42:02 -0500	[thread overview]
Message-ID: <20090623204202.GA25969@us.ibm.com> (raw)
In-Reply-To: <20090622190914.27923.84173.stgit-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>

Quoting Trond Myklebust (Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org):
> Signed-off-by: Trond Myklebust <Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>
> ---
> 
>  fs/nfs/super.c |   24 ++++++++++++++++++++++++
>  1 files changed, 24 insertions(+), 0 deletions(-)
> 
> 
> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
> index 8da7e59..daecbad 100644
> --- a/fs/nfs/super.c
> +++ b/fs/nfs/super.c
> @@ -2548,6 +2548,27 @@ static struct vfsmount *nfs_do_root_mount(struct file_system_type *fs_type,
>  	return root_mnt;
>  }
> 
> +static void nfs_fix_devname(const struct path *path, struct vfsmount *mnt)
> +{
> +	char *page = (char *) __get_free_page(GFP_KERNEL);
> +	char *devname, *tmp;
> +
> +	if (page == NULL)
> +		return;
> +	devname = nfs_path(path->mnt->mnt_devname,
> +			path->mnt->mnt_root, path->dentry,
> +			page, PAGE_SIZE);
> +	if (devname == NULL)
> +		goto out_freepage;
> +	tmp = kstrdup(devname, GFP_KERNEL);
> +	if (tmp == NULL)
> +		goto out_freepage;
> +	kfree(mnt->mnt_devname);
> +	mnt->mnt_devname = tmp;

(looking through patch 3 a bit) is this expected to be safe because all
callers will send in a mnt which was privately mounted as nfs root_mnt through
vfs_kern_mount?  So that at this point noone else can have a ref to
mnt?

If that isn't the intent, then this seems problematic...  (If it is, it
seems worth commenting both so that every reader doesn't feel compelled
to verify, and so that no new callers will naively violate that
expectation)

thanks,
-serge

> +out_freepage:
> +	free_page((unsigned long)page);
> +}
> +
>  static int nfs_follow_remote_path(struct vfsmount *root_mnt,
>  		const char *export_path, struct vfsmount *mnt_target)
>  {
> @@ -2574,6 +2595,9 @@ static int nfs_follow_remote_path(struct vfsmount *root_mnt,
>  	mnt_target->mnt_sb = s;
>  	mnt_target->mnt_root = dget(nd.path.dentry);
> 
> +	/* Correct the device pathname */
> +	nfs_fix_devname(&nd.path, mnt_target);
> +
>  	path_put(&nd.path);
>  	down_write(&s->s_umount);
>  	return 0;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2009-06-23 20:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-22 19:09 [PATCH 0/5] NFS private namespace patchset Trond Myklebust
2009-06-22 19:09 ` [PATCH 1/5] VFS: Uninline the function put_mnt_ns() Trond Myklebust
2009-06-22 19:09 ` [PATCH 3/5] NFSv4: Replace nfs4_path_walk() with VFS path lookup in a private namespace Trond Myklebust
     [not found] ` <20090622190913.27923.31665.stgit-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-06-22 19:09   ` [PATCH 2/5] VFS: Add VFS helper functions for setting up private namespaces Trond Myklebust
     [not found]     ` <20090622190913.27923.61549.stgit-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-06-23 20:13       ` Serge E. Hallyn
     [not found]         ` <20090623201307.GA25760-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-06-23 21:29           ` Trond Myklebust
2009-06-23 22:32             ` Serge E. Hallyn
     [not found]               ` <20090623223230.GA30173-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-06-24  2:51                 ` Linus Torvalds
2009-06-22 19:09   ` [PATCH 4/5] NFS: Fix nfs_path() to always return a '/' at the beginning of the path Trond Myklebust
2009-06-22 19:09   ` [PATCH 5/5] NFS: Correct the NFS mount path when following a referral Trond Myklebust
     [not found]     ` <20090622190914.27923.84173.stgit-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-06-23 20:42       ` Serge E. Hallyn [this message]
     [not found]         ` <20090623204202.GA25969-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-06-23 21:15           ` Trond Myklebust
2009-06-22 19:40 ` [PATCH 0/5] NFS private namespace patchset Linus Torvalds
2009-06-23 21:33   ` Al Viro
     [not found]     ` <20090623213309.GK8633-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2009-06-23 21:40       ` Linus Torvalds
2009-06-23 23:22         ` Al Viro
2009-06-24 12:58           ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090623204202.GA25969@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org \
    --cc=hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).