public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] nfs: remove nfs_show_devname
@ 2014-01-09 18:59 Jeff Layton
  2014-01-09 19:06 ` Trond Myklebust
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Layton @ 2014-01-09 18:59 UTC (permalink / raw)
  To: trond.myklebust; +Cc: Yin.JianHong, linux-nfs

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-09 19:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-09 18:59 [PATCH RFC] nfs: remove nfs_show_devname Jeff Layton
2014-01-09 19:06 ` Trond Myklebust
2014-01-09 19:12   ` Jeff Layton
2014-01-09 19:27     ` Trond Myklebust
2014-01-09 19:55       ` Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox