@@ -2318,10 +2318,12 @@ force_lookup:
goto out_notsup;
if (mask & MAY_NOT_BLOCK)
- return -ECHILD;
-
- cred = rpc_lookup_cred();
+ cred = rpc_lookup_cred_nonblock();
+ else
+ cred = rpc_lookup_cred();
if (!IS_ERR(cred)) {
+ if (mask & MAY_NOT_BLOCK)
+ return -ECHILD;
res = nfs_do_access(inode, cred, mask);
put_rpccred(cred);
} else
@@ -154,6 +154,7 @@ void rpc_destroy_generic_auth(void);
void rpc_destroy_authunix(void);
struct rpc_cred * rpc_lookup_cred(void);
+struct rpc_cred * rpc_lookup_cred_nonblock(void);
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 *);
@@ -38,6 +38,11 @@ struct rpc_cred *rpc_lookup_cred(void)
}
EXPORT_SYMBOL_GPL(rpc_lookup_cred);
+struct rpc_cred *rpc_lookup_cred_nonblock(void)
+{
+ return rpcauth_lookupcred(&generic_auth, 1);
+}
+
/*
* Public call interface for looking up machine creds.
*/