NFSv4: don't put ACCESS in OPEN compound if O_EXCL
[linux-2.6-block.git] / fs / nfs / nfs4xdr.c
index 657483c34e2867c5c8dd3e1eda4046bfc61a0bbc..0d6030510fe27f81ccfaeddcaf55493bb6083487 100644 (file)
@@ -2224,7 +2224,8 @@ static void nfs4_xdr_enc_open(struct rpc_rqst *req, struct xdr_stream *xdr,
        encode_putfh(xdr, args->fh, &hdr);
        encode_open(xdr, args, &hdr);
        encode_getfh(xdr, &hdr);
-       encode_access(xdr, args->access, &hdr);
+       if (args->access)
+               encode_access(xdr, args->access, &hdr);
        encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr);
        encode_nops(&hdr);
 }
@@ -2261,7 +2262,8 @@ static void nfs4_xdr_enc_open_noattr(struct rpc_rqst *req,
        encode_sequence(xdr, &args->seq_args, &hdr);
        encode_putfh(xdr, args->fh, &hdr);
        encode_open(xdr, args, &hdr);
-       encode_access(xdr, args->access, &hdr);
+       if (args->access)
+               encode_access(xdr, args->access, &hdr);
        encode_getfattr(xdr, args->bitmask, &hdr);
        encode_nops(&hdr);
 }
@@ -6239,7 +6241,8 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
        status = decode_getfh(xdr, &res->fh);
        if (status)
                goto out;
-       decode_access(xdr, &res->access_supported, &res->access_result);
+       if (res->access_request)
+               decode_access(xdr, &res->access_supported, &res->access_result);
        decode_getfattr(xdr, res->f_attr, res->server);
 out:
        return status;
@@ -6288,7 +6291,8 @@ static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp,
        status = decode_open(xdr, res);
        if (status)
                goto out;
-       decode_access(xdr, &res->access_supported, &res->access_result);
+       if (res->access_request)
+               decode_access(xdr, &res->access_supported, &res->access_result);
        decode_getfattr(xdr, res->f_attr, res->server);
 out:
        return status;