NFSv4: Retrieve ACCESS on open if we're not using NFS4_CREATE_EXCLUSIVE
NFS4_CREATE_EXCLUSIVE does not allow the caller to set an access mode, so for most Linux filesystems, the access call ends up returning no permissions. However both NFS4_CREATE_EXCLUSIVE4_1 and NFS4_CREATE_GUARDED allow the client to set the access mode. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
Родитель
43d20e80e2
Коммит
a1e7f30a86
|
@ -1388,27 +1388,22 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry,
|
||||||
sizeof(p->o_arg.u.verifier.data));
|
sizeof(p->o_arg.u.verifier.data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* don't put an ACCESS op in OPEN compound if O_EXCL, because ACCESS
|
/* ask server to check for all possible rights as results
|
||||||
* will return permission denied for all bits until close */
|
* are cached */
|
||||||
if (!(flags & O_EXCL)) {
|
switch (p->o_arg.claim) {
|
||||||
/* ask server to check for all possible rights as results
|
default:
|
||||||
* are cached */
|
break;
|
||||||
switch (p->o_arg.claim) {
|
case NFS4_OPEN_CLAIM_NULL:
|
||||||
default:
|
case NFS4_OPEN_CLAIM_FH:
|
||||||
break;
|
p->o_arg.access = NFS4_ACCESS_READ | NFS4_ACCESS_MODIFY |
|
||||||
case NFS4_OPEN_CLAIM_NULL:
|
NFS4_ACCESS_EXTEND | NFS4_ACCESS_DELETE |
|
||||||
case NFS4_OPEN_CLAIM_FH:
|
NFS4_ACCESS_EXECUTE;
|
||||||
p->o_arg.access = NFS4_ACCESS_READ |
|
|
||||||
NFS4_ACCESS_MODIFY |
|
|
||||||
NFS4_ACCESS_EXTEND |
|
|
||||||
NFS4_ACCESS_EXECUTE;
|
|
||||||
#ifdef CONFIG_NFS_V4_2
|
#ifdef CONFIG_NFS_V4_2
|
||||||
if (server->caps & NFS_CAP_XATTR)
|
if (!(server->caps & NFS_CAP_XATTR))
|
||||||
p->o_arg.access |= NFS4_ACCESS_XAREAD |
|
break;
|
||||||
NFS4_ACCESS_XAWRITE |
|
p->o_arg.access |= NFS4_ACCESS_XAREAD | NFS4_ACCESS_XAWRITE |
|
||||||
NFS4_ACCESS_XALIST;
|
NFS4_ACCESS_XALIST;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
p->o_arg.clientid = server->nfs_client->cl_clientid;
|
p->o_arg.clientid = server->nfs_client->cl_clientid;
|
||||||
p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time);
|
p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time);
|
||||||
|
@ -2472,11 +2467,15 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
|
||||||
/* Set the create mode (note dependency on the session type) */
|
/* Set the create mode (note dependency on the session type) */
|
||||||
data->o_arg.createmode = NFS4_CREATE_UNCHECKED;
|
data->o_arg.createmode = NFS4_CREATE_UNCHECKED;
|
||||||
if (data->o_arg.open_flags & O_EXCL) {
|
if (data->o_arg.open_flags & O_EXCL) {
|
||||||
data->o_arg.createmode = NFS4_CREATE_EXCLUSIVE;
|
data->o_arg.createmode = NFS4_CREATE_EXCLUSIVE4_1;
|
||||||
if (nfs4_has_persistent_session(clp))
|
if (clp->cl_mvops->minor_version == 0) {
|
||||||
|
data->o_arg.createmode = NFS4_CREATE_EXCLUSIVE;
|
||||||
|
/* don't put an ACCESS op in OPEN compound if O_EXCL,
|
||||||
|
* because ACCESS will return permission denied for
|
||||||
|
* all bits until close */
|
||||||
|
data->o_res.access_request = data->o_arg.access = 0;
|
||||||
|
} else if (nfs4_has_persistent_session(clp))
|
||||||
data->o_arg.createmode = NFS4_CREATE_GUARDED;
|
data->o_arg.createmode = NFS4_CREATE_GUARDED;
|
||||||
else if (clp->cl_mvops->minor_version > 0)
|
|
||||||
data->o_arg.createmode = NFS4_CREATE_EXCLUSIVE4_1;
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
unlock_no_action:
|
unlock_no_action:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче