Commit bba67e0e authored by Trond Myklebust's avatar Trond Myklebust

NFS: Remove BKL usage from open()

All the NFSv4 stateful operations are already protected by other locks (in
particular by the rpc_sequence locks.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent b6a2e569
...@@ -139,10 +139,8 @@ nfs_opendir(struct inode *inode, struct file *filp) ...@@ -139,10 +139,8 @@ nfs_opendir(struct inode *inode, struct file *filp)
nfs_inc_stats(inode, NFSIOS_VFSOPEN); nfs_inc_stats(inode, NFSIOS_VFSOPEN);
lock_kernel();
/* Call generic open code in order to cache credentials */ /* Call generic open code in order to cache credentials */
res = nfs_open(inode, filp); res = nfs_open(inode, filp);
unlock_kernel();
return res; return res;
} }
...@@ -1019,9 +1017,7 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry ...@@ -1019,9 +1017,7 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
} }
/* Open the file on the server */ /* Open the file on the server */
lock_kernel();
res = nfs4_atomic_open(dir, dentry, nd); res = nfs4_atomic_open(dir, dentry, nd);
unlock_kernel();
if (IS_ERR(res)) { if (IS_ERR(res)) {
error = PTR_ERR(res); error = PTR_ERR(res);
switch (error) { switch (error) {
...@@ -1083,9 +1079,7 @@ static int nfs_open_revalidate(struct dentry *dentry, struct nameidata *nd) ...@@ -1083,9 +1079,7 @@ static int nfs_open_revalidate(struct dentry *dentry, struct nameidata *nd)
* operations that change the directory. We therefore save the * operations that change the directory. We therefore save the
* change attribute *before* we do the RPC call. * change attribute *before* we do the RPC call.
*/ */
lock_kernel();
ret = nfs4_open_revalidate(dir, dentry, openflags, nd); ret = nfs4_open_revalidate(dir, dentry, openflags, nd);
unlock_kernel();
out: out:
dput(parent); dput(parent);
if (!ret) if (!ret)
......
...@@ -128,9 +128,7 @@ nfs_file_open(struct inode *inode, struct file *filp) ...@@ -128,9 +128,7 @@ nfs_file_open(struct inode *inode, struct file *filp)
return res; return res;
nfs_inc_stats(inode, NFSIOS_VFSOPEN); nfs_inc_stats(inode, NFSIOS_VFSOPEN);
lock_kernel();
res = nfs_open(inode, filp); res = nfs_open(inode, filp);
unlock_kernel();
return res; return res;
} }
......
...@@ -451,9 +451,7 @@ static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata) ...@@ -451,9 +451,7 @@ static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata)
/* Save the delegation */ /* Save the delegation */
memcpy(stateid.data, delegation->stateid.data, sizeof(stateid.data)); memcpy(stateid.data, delegation->stateid.data, sizeof(stateid.data));
rcu_read_unlock(); rcu_read_unlock();
lock_kernel();
ret = nfs_may_open(state->inode, state->owner->so_cred, open_mode); ret = nfs_may_open(state->inode, state->owner->so_cred, open_mode);
unlock_kernel();
if (ret != 0) if (ret != 0)
goto out; goto out;
ret = -EAGAIN; ret = -EAGAIN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment