]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
NFS: Fix an Oops in nfs_d_automount()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 14 Nov 2022 22:30:39 +0000 (17:30 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 28 Nov 2022 03:10:00 +0000 (22:10 -0500)
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>
fs/nfs/namespace.c

index 2f336ace755546e327bae19cbdc117f1cbb380d2..88a23af2bd5c9caba956b392f8bcd3ca677a62e0 100644 (file)
@@ -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;