Skip to contentSkip to conversation

NFS: Fix an Oops in nfs_d_automount()

PATCH New [email protected] 1 participant 1 message Nov 17, 2022

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 NFS: Fix an Oops in nfs_d_automount()

From: Trond Myklebust <[email protected]>

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")
---
 fs/nfs/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/namespace.c +1 -1
index 2f336ace7555..88a23af2bd5c 100644
@@ -147,7 +147,7 @@ struct vfsmount *nfs_d_automount(struct path *path)
 	struct nfs_fs_context *ctx;
 	struct fs_context *fc;
 	struct vfsmount *mnt = ERR_PTR(-ENOMEM);
-	struct nfs_server *server = NFS_SERVER(d_inode(path->dentry));
+	struct nfs_server *server = NFS_SB(path->dentry->d_sb);
 	struct nfs_client *client = server->nfs_client;
 	int timeout = READ_ONCE(nfs_mountpoint_expiry_timeout);
 	int ret;
Signature · 1 line
2.38.1