public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: trond.myklebust@primarydata.com
Cc: "Yin.JianHong" <jiyin@redhat.com>, linux-nfs@vger.kernel.org
Subject: [PATCH RFC] nfs: remove nfs_show_devname
Date: Thu,  9 Jan 2014 13:59:55 -0500	[thread overview]
Message-ID: <1389293995-634-1-git-send-email-jlayton@redhat.com> (raw)

The nfs code will currently construct a devname to show in places like
/proc/mounts by turning a dentry into a path. Unfortunately, that's
somewhat problematic if the user ended up mounting through a symlink on
the server. The devname that then shows up in /proc/mounts now doesn't
match the one that was originally passed into the mount request.

For instance, suppose a server is exporting a filesystem "/export". We
then have this in /export:

    $ ls -ld foo bar
    lrwxrwxrwx. 1 root root 3 Jan  9 13:46 bar -> foo
    drwxr-xr-x. 2 root root 6 Jan  9 13:45 foo

Now, on the client we mount up 'bar':

    # mount server:/export/bar /mnt/server

...and 'df' now shows a different devname altogether.

    server:/export/foo                20G   66M   20G   1% /mnt/server

In the "old days", this didn't really matter since /proc/mounts was just
informational. On modern distros /etc/mtab is usually a symlink to
/proc/mounts so this means that unmounting by devname isn't always
reliable.

This patch just removes all of this code and has nfs just use the
kernel's standard facility for tracking the devname. With this, the
actual device name used to do the mount is displayed in
/proc/self/mounts, /proc/self/mountinfo, and /proc/self/mountstats.

Reported-by: Yin.JianHong <jiyin@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/nfs/internal.h  |  1 -
 fs/nfs/nfs4super.c |  1 -
 fs/nfs/super.c     | 18 ------------------
 3 files changed, 20 deletions(-)

diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 8b5cc04..4e17d3f 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -403,7 +403,6 @@ void nfs_clone_super(struct super_block *, struct nfs_mount_info *);
 void nfs_umount_begin(struct super_block *);
 int  nfs_statfs(struct dentry *, struct kstatfs *);
 int  nfs_show_options(struct seq_file *, struct dentry *);
-int  nfs_show_devname(struct seq_file *, struct dentry *);
 int  nfs_show_path(struct seq_file *, struct dentry *);
 int  nfs_show_stats(struct seq_file *, struct dentry *);
 void nfs_put_super(struct super_block *);
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c
index 65ab0a0..dc09ad2 100644
--- a/fs/nfs/nfs4super.c
+++ b/fs/nfs/nfs4super.c
@@ -58,7 +58,6 @@ static const struct super_operations nfs4_sops = {
 	.evict_inode	= nfs4_evict_inode,
 	.umount_begin	= nfs_umount_begin,
 	.show_options	= nfs_show_options,
-	.show_devname	= nfs_show_devname,
 	.show_path	= nfs_show_path,
 	.show_stats	= nfs_show_stats,
 	.remount_fs	= nfs_remount,
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 910ed90..9490d8ef 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -316,7 +316,6 @@ const struct super_operations nfs_sops = {
 	.evict_inode	= nfs_evict_inode,
 	.umount_begin	= nfs_umount_begin,
 	.show_options	= nfs_show_options,
-	.show_devname	= nfs_show_devname,
 	.show_path	= nfs_show_path,
 	.show_stats	= nfs_show_stats,
 	.remount_fs	= nfs_remount,
@@ -773,23 +772,6 @@ static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
 }
 #endif
 
-int nfs_show_devname(struct seq_file *m, struct dentry *root)
-{
-	char *page = (char *) __get_free_page(GFP_KERNEL);
-	char *devname, *dummy;
-	int err = 0;
-	if (!page)
-		return -ENOMEM;
-	devname = nfs_path(&dummy, root, page, PAGE_SIZE, 0);
-	if (IS_ERR(devname))
-		err = PTR_ERR(devname);
-	else
-		seq_escape(m, devname, " \t\n\\");
-	free_page((unsigned long)page);
-	return err;
-}
-EXPORT_SYMBOL_GPL(nfs_show_devname);
-
 int nfs_show_path(struct seq_file *m, struct dentry *dentry)
 {
 	seq_puts(m, "/");
-- 
1.8.4.2


             reply	other threads:[~2014-01-09 19:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09 18:59 Jeff Layton [this message]
2014-01-09 19:06 ` [PATCH RFC] nfs: remove nfs_show_devname Trond Myklebust
2014-01-09 19:12   ` Jeff Layton
2014-01-09 19:27     ` Trond Myklebust
2014-01-09 19:55       ` Jeff Layton

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=1389293995-634-1-git-send-email-jlayton@redhat.com \
    --to=jlayton@redhat.com \
    --cc=jiyin@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.com \
    /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