@@ -102,7 +102,7 @@ nfs_opendir(struct inode *inode, struct file *filp)
nfs_inc_stats(inode, NFSIOS_VFSOPEN);
- cred = rpc_lookup_cred();
+ cred = rpc_lookup_cred(0);
if (IS_ERR(cred))
return PTR_ERR(cred);
ctx = alloc_nfs_open_dir_context(inode, cred);
@@ -2308,11 +2308,11 @@ force_lookup:
if (!NFS_PROTO(inode)->access)
goto out_notsup;
- if (mask & MAY_NOT_BLOCK)
- return -ECHILD;
- cred = rpc_lookup_cred();
+ cred = rpc_lookup_cred(mask & MAY_NOT_BLOCK);
if (!IS_ERR(cred)) {
+ if (mask & MAY_NOT_BLOCK)
+ return -ECHILD;
res = nfs_do_access(inode, cred, mask);
put_rpccred(cred);
} else
@@ -717,7 +717,7 @@ EXPORT_SYMBOL_GPL(nfs_close_context);
struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode)
{
struct nfs_open_context *ctx;
- struct rpc_cred *cred = rpc_lookup_cred();
+ struct rpc_cred *cred = rpc_lookup_cred(0);
if (IS_ERR(cred))
return ERR_CAST(cred);
@@ -4733,7 +4733,7 @@ nfs4_set_security_label(struct dentry *dentry, const void *buf, size_t buflen)
ilabel.label = (char *)buf;
ilabel.len = buflen;
- cred = rpc_lookup_cred();
+ cred = rpc_lookup_cred(0);
if (IS_ERR(cred))
return PTR_ERR(cred);
@@ -258,7 +258,7 @@ nfs_async_unlink(struct inode *dir, struct dentry *dentry)
if (data == NULL)
goto out;
- data->cred = rpc_lookup_cred();
+ data->cred = rpc_lookup_cred(0);
if (IS_ERR(data->cred)) {
status = PTR_ERR(data->cred);
goto out_free;
@@ -418,7 +418,7 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
return ERR_PTR(-ENOMEM);
task_setup_data.callback_data = data;
- data->cred = rpc_lookup_cred();
+ data->cred = rpc_lookup_cred(0);
if (IS_ERR(data->cred)) {
struct rpc_task *task = ERR_CAST(data->cred);
kfree(data);
@@ -153,7 +153,7 @@ void rpcauth_remove_module(void);
void rpc_destroy_generic_auth(void);
void rpc_destroy_authunix(void);
-struct rpc_cred * rpc_lookup_cred(void);
+struct rpc_cred * rpc_lookup_cred(int rcu_walk);
struct rpc_cred * rpc_lookup_machine_cred(const char *service_name);
int rpcauth_register(const struct rpc_authops *);
int rpcauth_unregister(const struct rpc_authops *);
@@ -32,9 +32,10 @@ static const struct rpc_credops generic_credops;
/*
* Public call interface
*/
-struct rpc_cred *rpc_lookup_cred(void)
+struct rpc_cred *rpc_lookup_cred(int rcu_walk)
{
- return rpcauth_lookupcred(&generic_auth, 0);
+ return rpcauth_lookupcred(&generic_auth,
+ rcu_walk ? RPCAUTH_LOOKUP_RCU : 0);
}
EXPORT_SYMBOL_GPL(rpc_lookup_cred);
This arg causes rpc_lookup_cred to set RPCAUTH_LOOKUP_RCU when performing the credential lookup. Most callers pass '0', except nfs_permission() which passes (mask & MAY_NOT_BLOCK). This doesn't speed up nfs_permission yet as it is not yet safe to call nfs_do_access with the returned cred. Signed-off-by: NeilBrown <neilb@suse.de> --- fs/nfs/dir.c | 8 ++++---- fs/nfs/inode.c | 2 +- fs/nfs/nfs4proc.c | 2 +- fs/nfs/unlink.c | 4 ++-- include/linux/sunrpc/auth.h | 2 +- net/sunrpc/auth_generic.c | 5 +++-- 6 files changed, 12 insertions(+), 11 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html