From: Trond Myklebust <trond.myklebust@hammerspace.com>
Date: Mon, 14 Nov 2022 17:30:39 -0500
Subject: [PATCH] NFS: Fix an Oops in nfs_d_automount()
Git-commit: 35e3b6ae84935d0d7ff76cbdaa83411b0ad5e471
Patch-mainline: v6.2
References: git-fixes
When mounting from a NFSv4 referral, path->dentry can end up being a
negative dentry, so derive the struct nfs_server from the dentry
itself instead.
Fixes: 2b0143b5c986 ("VFS: normal filesystems (and lustre): d_inode() annotations")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Acked-by: NeilBrown <neilb@suse.com>
---
fs/nfs/namespace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -143,7 +143,7 @@ EXPORT_SYMBOL_GPL(nfs_path);
struct vfsmount *nfs_d_automount(struct path *path)
{
struct vfsmount *mnt;
- struct nfs_server *server = NFS_SERVER(d_inode(path->dentry));
+ struct nfs_server *server = NFS_SB(path->dentry->d_sb);
struct nfs_fh *fh = NULL;
struct nfs_fattr *fattr = NULL;