Skip to content

Commit fc0f684

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
NFS: Remove BKL from NFS lookup code
All dentry-related operations are already BKL-safe, since they are protected by the VFS locking. No extra locks should be needed in the NFS code. In the case of nfs_revalidate_inode(), we're only doing an attribute update (protected by the inode->i_lock). In the case of nfs_lookup(), we're instantiating a new dentry, so there should be no contention possible until after we call d_materialise_unique. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent fc81af5 commit fc0f684

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

fs/nfs/dir.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,6 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd)
777777
struct nfs_fattr fattr;
778778

779779
parent = dget_parent(dentry);
780-
lock_kernel();
781780
dir = parent->d_inode;
782781
nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE);
783782
inode = dentry->d_inode;
@@ -815,7 +814,6 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd)
815814

816815
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
817816
out_valid:
818-
unlock_kernel();
819817
dput(parent);
820818
dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is valid\n",
821819
__func__, dentry->d_parent->d_name.name,
@@ -834,7 +832,6 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd)
834832
shrink_dcache_parent(dentry);
835833
}
836834
d_drop(dentry);
837-
unlock_kernel();
838835
dput(parent);
839836
dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is invalid\n",
840837
__func__, dentry->d_parent->d_name.name,
@@ -921,16 +918,14 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
921918
res = ERR_PTR(-ENOMEM);
922919
dentry->d_op = NFS_PROTO(dir)->dentry_ops;
923920

924-
lock_kernel();
925-
926921
/*
927922
* If we're doing an exclusive create, optimize away the lookup
928923
* but don't hash the dentry.
929924
*/
930925
if (nfs_is_exclusive_create(dir, nd)) {
931926
d_instantiate(dentry, NULL);
932927
res = NULL;
933-
goto out_unlock;
928+
goto out;
934929
}
935930

936931
parent = dentry->d_parent;
@@ -958,8 +953,6 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
958953
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
959954
out_unblock_sillyrename:
960955
nfs_unblock_sillyrename(parent);
961-
out_unlock:
962-
unlock_kernel();
963956
out:
964957
return res;
965958
}

0 commit comments

Comments
 (0)