@@ -2232,6 +2232,10 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask)
if (status == 0)
goto out_cached;
+ status = -ECHILD;
+ if (mask & MAY_NOT_BLOCK)
+ goto out;
+
/* Be clever: ask server to check for all possible rights */
cache.mask = MAY_EXEC | MAY_WRITE | MAY_READ;
cache.cred = cred;
@@ -2311,10 +2315,9 @@ force_lookup:
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);
+ if (!(mask & MAY_NOT_BLOCK))
+ put_rpccred(cred);
} else
res = PTR_ERR(cred);
out:
If MAY_NOT_BLOCK is set we return -ECHILD in preference to making a network call. This allows nfs_permission to call it in RCU-walk mode. Now nfs_permission() can often complete in RCU-walk mode with no error. Signed-off-by: NeilBrown <neilb@suse.de> --- fs/nfs/dir.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 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