NFSv4: Retry the DELEGRETURN if the embedded GETATTR is rejected with EACCES

If our DELEGRETURN RPC call is rejected with an EACCES call, then we should
remove the GETATTR call from the compound RPC and retry.
This could potentially happen when there is a conflict between an
ACL denying attribute reads and our use of SP4_MACH_CRED.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
Trond Myklebust 2016-12-19 10:23:10 -05:00
Родитель f07d4a31cc
Коммит 8ac2b42238
2 изменённых файлов: 15 добавлений и 4 удалений

Просмотреть файл

@ -5695,6 +5695,14 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
case -NFS4ERR_STALE_STATEID: case -NFS4ERR_STALE_STATEID:
task->tk_status = 0; task->tk_status = 0;
break; break;
case -NFS4ERR_ACCESS:
if (data->args.bitmask) {
data->args.bitmask = NULL;
data->res.fattr = NULL;
task->tk_status = 0;
rpc_restart_call_prepare(task);
return;
}
default: default:
if (nfs4_async_handle_error(task, data->res.server, if (nfs4_async_handle_error(task, data->res.server,
NULL, NULL) == -EAGAIN) { NULL, NULL) == -EAGAIN) {

Просмотреть файл

@ -2705,7 +2705,8 @@ static void nfs4_xdr_enc_delegreturn(struct rpc_rqst *req,
encode_putfh(xdr, args->fhandle, &hdr); encode_putfh(xdr, args->fhandle, &hdr);
if (args->lr_args) if (args->lr_args)
encode_layoutreturn(xdr, args->lr_args, &hdr); encode_layoutreturn(xdr, args->lr_args, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr); if (args->bitmask)
encode_getfattr(xdr, args->bitmask, &hdr);
encode_delegreturn(xdr, args->stateid, &hdr); encode_delegreturn(xdr, args->stateid, &hdr);
encode_nops(&hdr); encode_nops(&hdr);
} }
@ -6972,9 +6973,11 @@ static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp,
if (status) if (status)
goto out; goto out;
} }
status = decode_getfattr(xdr, res->fattr, res->server); if (res->fattr) {
if (status != 0) status = decode_getfattr(xdr, res->fattr, res->server);
goto out; if (status != 0)
goto out;
}
status = decode_delegreturn(xdr); status = decode_delegreturn(xdr);
out: out:
return status; return status;