nfs: Add .lookup methods to nfs_mountpoint_inode_operations NFSv4 client code in some cases can call generic vfs_path_lookup() during mount(2). Inside this generic function .lookup method should be called. But nfs_mountpoint_inode_operations and nfs_referral_inode_operations don't have .lookup method that causes 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 Signed-off-by: Gusev Vitaliy <gusev.vitaliy@xxxxxxxxx> --- diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 662df2a..9d60b29 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -110,7 +110,6 @@ const struct inode_operations nfs3_dir_inode_operations = { #ifdef CONFIG_NFS_V4 -static struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *); static int nfs_open_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd); const struct inode_operations nfs4_dir_inode_operations = { .create = nfs_open_create, @@ -1317,7 +1316,7 @@ out: return ret; } -static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) +struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) { struct nfs_open_context *ctx; struct iattr attr; diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 0a9ea58..92c4627 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -266,6 +266,7 @@ extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *); extern struct dentry *nfs4_get_root(struct super_block *, struct nfs_fh *); extern int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh); +extern struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *); #endif /* read.c */ diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index db6aa36..c5f9162 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c @@ -177,10 +177,16 @@ out_follow: const struct inode_operations nfs_mountpoint_inode_operations = { .follow_link = nfs_follow_mountpoint, .getattr = nfs_getattr, +#ifdef CONFIG_NFS_V4 + .lookup = nfs_atomic_lookup, +#endif }; const struct inode_operations nfs_referral_inode_operations = { .follow_link = nfs_follow_mountpoint, +#ifdef CONFIG_NFS_V4 + .lookup = nfs_atomic_lookup, +#endif }; static void nfs_expire_automounts(struct work_struct *work) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html