diff options
author | Weston Andros Adamson <dros@netapp.com> | 2012-10-02 17:49:52 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-02 17:56:19 -0400 |
commit | ae2bb03236fc978bdf673c19d39832500793b83c (patch) | |
tree | e88215f4a387fdcc6ef9183f61d12477b5b7e2bd /fs | |
parent | bbd3a8eee82a2a6f4aa1cce60ccb014f25e5c560 (diff) |
NFSv4: don't put ACCESS in OPEN compound if O_EXCL
Don't put an ACCESS op in OPEN compound if O_EXCL, because ACCESS
will return permission denied for all bits until close.
Fixes a regression due to commit 6168f62c (NFSv4: Add ACCESS operation to
OPEN compound)
Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 12 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 12 |
2 files changed, 17 insertions, 7 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index ccada6856f0d..21cfac7c2ff8 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -862,9 +862,15 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, | |||
862 | p->o_arg.fh = NFS_FH(dir); | 862 | p->o_arg.fh = NFS_FH(dir); |
863 | p->o_arg.open_flags = flags; | 863 | p->o_arg.open_flags = flags; |
864 | p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE); | 864 | p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE); |
865 | /* ask server to check for all possible rights as results are cached */ | 865 | /* don't put an ACCESS op in OPEN compound if O_EXCL, because ACCESS |
866 | p->o_arg.access = NFS4_ACCESS_READ | NFS4_ACCESS_MODIFY | | 866 | * will return permission denied for all bits until close */ |
867 | NFS4_ACCESS_EXTEND | NFS4_ACCESS_EXECUTE; | 867 | if (!(flags & O_EXCL)) { |
868 | /* ask server to check for all possible rights as results | ||
869 | * are cached */ | ||
870 | p->o_arg.access = NFS4_ACCESS_READ | NFS4_ACCESS_MODIFY | | ||
871 | NFS4_ACCESS_EXTEND | NFS4_ACCESS_EXECUTE; | ||
872 | p->o_res.access_request = p->o_arg.access; | ||
873 | } | ||
868 | p->o_arg.clientid = server->nfs_client->cl_clientid; | 874 | p->o_arg.clientid = server->nfs_client->cl_clientid; |
869 | p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time); | 875 | p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time); |
870 | p->o_arg.id.uniquifier = sp->so_seqid.owner_id; | 876 | p->o_arg.id.uniquifier = sp->so_seqid.owner_id; |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 657483c34e28..0d6030510fe2 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -2224,7 +2224,8 @@ static void nfs4_xdr_enc_open(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
2224 | encode_putfh(xdr, args->fh, &hdr); | 2224 | encode_putfh(xdr, args->fh, &hdr); |
2225 | encode_open(xdr, args, &hdr); | 2225 | encode_open(xdr, args, &hdr); |
2226 | encode_getfh(xdr, &hdr); | 2226 | encode_getfh(xdr, &hdr); |
2227 | encode_access(xdr, args->access, &hdr); | 2227 | if (args->access) |
2228 | encode_access(xdr, args->access, &hdr); | ||
2228 | encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr); | 2229 | encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr); |
2229 | encode_nops(&hdr); | 2230 | encode_nops(&hdr); |
2230 | } | 2231 | } |
@@ -2261,7 +2262,8 @@ static void nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, | |||
2261 | encode_sequence(xdr, &args->seq_args, &hdr); | 2262 | encode_sequence(xdr, &args->seq_args, &hdr); |
2262 | encode_putfh(xdr, args->fh, &hdr); | 2263 | encode_putfh(xdr, args->fh, &hdr); |
2263 | encode_open(xdr, args, &hdr); | 2264 | encode_open(xdr, args, &hdr); |
2264 | encode_access(xdr, args->access, &hdr); | 2265 | if (args->access) |
2266 | encode_access(xdr, args->access, &hdr); | ||
2265 | encode_getfattr(xdr, args->bitmask, &hdr); | 2267 | encode_getfattr(xdr, args->bitmask, &hdr); |
2266 | encode_nops(&hdr); | 2268 | encode_nops(&hdr); |
2267 | } | 2269 | } |
@@ -6239,7 +6241,8 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr, | |||
6239 | status = decode_getfh(xdr, &res->fh); | 6241 | status = decode_getfh(xdr, &res->fh); |
6240 | if (status) | 6242 | if (status) |
6241 | goto out; | 6243 | goto out; |
6242 | decode_access(xdr, &res->access_supported, &res->access_result); | 6244 | if (res->access_request) |
6245 | decode_access(xdr, &res->access_supported, &res->access_result); | ||
6243 | decode_getfattr(xdr, res->f_attr, res->server); | 6246 | decode_getfattr(xdr, res->f_attr, res->server); |
6244 | out: | 6247 | out: |
6245 | return status; | 6248 | return status; |
@@ -6288,7 +6291,8 @@ static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, | |||
6288 | status = decode_open(xdr, res); | 6291 | status = decode_open(xdr, res); |
6289 | if (status) | 6292 | if (status) |
6290 | goto out; | 6293 | goto out; |
6291 | decode_access(xdr, &res->access_supported, &res->access_result); | 6294 | if (res->access_request) |
6295 | decode_access(xdr, &res->access_supported, &res->access_result); | ||
6292 | decode_getfattr(xdr, res->f_attr, res->server); | 6296 | decode_getfattr(xdr, res->f_attr, res->server); |
6293 | out: | 6297 | out: |
6294 | return status; | 6298 | return status; |