linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] nfs: Fix oops due to derefence ->lookup method
@ 2011-02-07 16:38 Vitaliy Gusev
  0 siblings, 0 replies; only message in thread
From: Vitaliy Gusev @ 2011-02-07 16:38 UTC (permalink / raw)
  To: Al Viro; +Cc: Trond Myklebust, David Howells, linux-fsdevel

During mount if rpc_ops->getroot() and rpc_ops->getattr()
returns different filehandles then nfs_getfh() set i_op
of NFS root inode to nfs_mountpoint_inode_operations.

After that  nfs_follow_remote_path() raised oops:

     d_alloc_and_lookup+0x4c/0x74
     do_lookup+0x1e3/0x280
     link_path_walk+0x12e/0xab0
     nfs4_remote_get_sb+0x56/0x2c0 [nfs]
     path_walk+0x67/0xe0
     vfs_path_lookup+0x8e/0x100
     nfs_follow_remote_path+0x16f/0x3e0 [nfs]
     nfs4_try_mount+0x6f/0xd0 [nfs]
     nfs_get_sb+0x269/0x400 [nfs]
     vfs_kern_mount+0x8a/0x1f0
     do_kern_mount+0x52/0x130
     do_mount+0x20a/0x260
     sys_mount+0x90/0xe0
     system_call_fastpath+0x16/0x1b

So just refresh fsid, as RFC3530 doesn't specify behavior
in case of rootfh changes fsid.

Signed-off-by: Gusev Vitaliy <gusev.vitaliy@nexenta.com>
---
 fs/nfs/getroot.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index 3031ef7..914eb78 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -192,6 +192,10 @@ struct dentry *nfs4_get_root(struct super_block
*sb, struct nfs_fh *mntfh)
 		goto out;
 	}
 
+	if (fattr->valid & NFS_ATTR_FATTR_FSID &&
+	    !nfs_fsid_equal(&server->fsid, &fattr->fsid))
+		memcpy(&server->fsid, &fattr->fsid, sizeof(server->fsid));
+
 	inode = nfs_fhget(sb, mntfh, fattr);
 	if (IS_ERR(inode)) {
 		dprintk("nfs_get_root: get root inode failed\n");




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-02-07 16:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-07 16:38 [PATCH 3/3] nfs: Fix oops due to derefence ->lookup method Vitaliy Gusev

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).