diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-10-18 17:20:15 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-10-18 17:20:15 -0400 |
commit | 06735b3454824bd561decbde46111f144e905923 (patch) | |
tree | 2c9e9f18ba8d3700a181b44d2b1f0ce6a62612f8 /fs/nfs/nfs4xdr.c | |
parent | faf5f49c2d9c0af2847837c232a432cc146e203b (diff) |
NFSv4: Fix up handling of open_to_lock sequence ids
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 4706192cfb07..c5c75235c5b8 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -729,22 +729,18 @@ static int encode_lock(struct xdr_stream *xdr, const struct nfs_lockargs *arg) | |||
729 | WRITE64(arg->length); | 729 | WRITE64(arg->length); |
730 | WRITE32(opargs->new_lock_owner); | 730 | WRITE32(opargs->new_lock_owner); |
731 | if (opargs->new_lock_owner){ | 731 | if (opargs->new_lock_owner){ |
732 | struct nfs_open_to_lock *ol = opargs->u.open_lock; | ||
733 | |||
734 | RESERVE_SPACE(40); | 732 | RESERVE_SPACE(40); |
735 | WRITE32(ol->open_seqid->sequence->counter); | 733 | WRITE32(opargs->open_seqid->sequence->counter); |
736 | WRITEMEM(&ol->open_stateid, sizeof(ol->open_stateid)); | 734 | WRITEMEM(opargs->open_stateid->data, sizeof(opargs->open_stateid->data)); |
737 | WRITE32(ol->lock_seqid->sequence->counter); | 735 | WRITE32(opargs->lock_seqid->sequence->counter); |
738 | WRITE64(ol->lock_owner.clientid); | 736 | WRITE64(opargs->lock_owner.clientid); |
739 | WRITE32(4); | 737 | WRITE32(4); |
740 | WRITE32(ol->lock_owner.id); | 738 | WRITE32(opargs->lock_owner.id); |
741 | } | 739 | } |
742 | else { | 740 | else { |
743 | struct nfs_exist_lock *el = opargs->u.exist_lock; | ||
744 | |||
745 | RESERVE_SPACE(20); | 741 | RESERVE_SPACE(20); |
746 | WRITEMEM(&el->stateid, sizeof(el->stateid)); | 742 | WRITEMEM(opargs->lock_stateid->data, sizeof(opargs->lock_stateid->data)); |
747 | WRITE32(el->seqid->sequence->counter); | 743 | WRITE32(opargs->lock_seqid->sequence->counter); |
748 | } | 744 | } |
749 | 745 | ||
750 | return 0; | 746 | return 0; |
@@ -1535,16 +1531,14 @@ static int nfs4_xdr_enc_lock(struct rpc_rqst *req, uint32_t *p, struct nfs_locka | |||
1535 | .nops = 2, | 1531 | .nops = 2, |
1536 | }; | 1532 | }; |
1537 | struct nfs_lock_opargs *opargs = args->u.lock; | 1533 | struct nfs_lock_opargs *opargs = args->u.lock; |
1538 | struct nfs_seqid *seqid; | ||
1539 | int status; | 1534 | int status; |
1540 | 1535 | ||
1541 | if (opargs->new_lock_owner) | 1536 | status = nfs_wait_on_sequence(opargs->lock_seqid, req->rq_task); |
1542 | seqid = opargs->u.open_lock->lock_seqid; | ||
1543 | else | ||
1544 | seqid = opargs->u.exist_lock->seqid; | ||
1545 | status = nfs_wait_on_sequence(seqid, req->rq_task); | ||
1546 | if (status != 0) | 1537 | if (status != 0) |
1547 | goto out; | 1538 | goto out; |
1539 | /* Do we need to do an open_to_lock_owner? */ | ||
1540 | if (opargs->lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED) | ||
1541 | opargs->new_lock_owner = 0; | ||
1548 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1542 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1549 | encode_compound_hdr(&xdr, &hdr); | 1543 | encode_compound_hdr(&xdr, &hdr); |
1550 | status = encode_putfh(&xdr, args->fh); | 1544 | status = encode_putfh(&xdr, args->fh); |
@@ -2908,8 +2902,8 @@ static int decode_lock(struct xdr_stream *xdr, struct nfs_lockres *res) | |||
2908 | 2902 | ||
2909 | status = decode_op_hdr(xdr, OP_LOCK); | 2903 | status = decode_op_hdr(xdr, OP_LOCK); |
2910 | if (status == 0) { | 2904 | if (status == 0) { |
2911 | READ_BUF(sizeof(nfs4_stateid)); | 2905 | READ_BUF(sizeof(res->u.stateid.data)); |
2912 | COPYMEM(&res->u.stateid, sizeof(res->u.stateid)); | 2906 | COPYMEM(res->u.stateid.data, sizeof(res->u.stateid.data)); |
2913 | } else if (status == -NFS4ERR_DENIED) | 2907 | } else if (status == -NFS4ERR_DENIED) |
2914 | return decode_lock_denied(xdr, &res->u.denied); | 2908 | return decode_lock_denied(xdr, &res->u.denied); |
2915 | return status; | 2909 | return status; |