NFS: Fix missing unlock in nfs_unlink()
authorSun Ke <sunke32@huawei.com>
Fri, 12 Aug 2022 01:14:40 +0000 (09:14 +0800)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Sat, 13 Aug 2022 17:02:13 +0000 (13:02 -0400)
Add the missing unlock before goto.

Fixes: 3c59366c207e ("NFS: don't unhash dentry during unlink/rename")
Signed-off-by: Sun Ke <sunke32@huawei.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/dir.c

index dbab3caa15ed505fa88c10b22af5eefbd7884771..1b879584d4fe8276bf81edf32f914473a2613edd 100644 (file)
@@ -2484,8 +2484,10 @@ int nfs_unlink(struct inode *dir, struct dentry *dentry)
         */
        error = -ETXTBSY;
        if (WARN_ON(dentry->d_flags & DCACHE_NFSFS_RENAMED) ||
-           WARN_ON(dentry->d_fsdata == NFS_FSDATA_BLOCKED))
+           WARN_ON(dentry->d_fsdata == NFS_FSDATA_BLOCKED)) {
+               spin_unlock(&dentry->d_lock);
                goto out;
+       }
        if (dentry->d_fsdata)
                /* old devname */
                kfree(dentry->d_fsdata);