diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-02 13:58:33 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:39 -0400 |
commit | 9f958ab8858c75df800e0121b1920182820cbc39 (patch) | |
tree | 754bb9d68aac077825b40796e2acf716bce5df08 /fs/nfs/nfs4xdr.c | |
parent | 88d9093997e1c73ca98db41b5605dbde7783845f (diff) |
NFSv4: Reduce the chances of an open_owner identifier collision
Currently we just use a 32-bit counter.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 4c8f67d47523..c08738441f73 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -68,10 +68,10 @@ static int nfs4_stat_to_errno(int); | |||
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | /* lock,open owner id: | 70 | /* lock,open owner id: |
71 | * we currently use size 1 (u32) out of (NFS4_OPAQUE_LIMIT >> 2) | 71 | * we currently use size 2 (u64) out of (NFS4_OPAQUE_LIMIT >> 2) |
72 | */ | 72 | */ |
73 | #define open_owner_id_maxsz (1 + 1) | 73 | #define open_owner_id_maxsz (1 + 4) |
74 | #define lock_owner_id_maxsz (1 + 1) | 74 | #define lock_owner_id_maxsz (1 + 4) |
75 | #define compound_encode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) | 75 | #define compound_encode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) |
76 | #define compound_decode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) | 76 | #define compound_decode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) |
77 | #define op_encode_hdr_maxsz (1) | 77 | #define op_encode_hdr_maxsz (1) |
@@ -827,13 +827,14 @@ static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args) | |||
827 | WRITE64(nfs4_lock_length(args->fl)); | 827 | WRITE64(nfs4_lock_length(args->fl)); |
828 | WRITE32(args->new_lock_owner); | 828 | WRITE32(args->new_lock_owner); |
829 | if (args->new_lock_owner){ | 829 | if (args->new_lock_owner){ |
830 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+20); | 830 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+32); |
831 | WRITE32(args->open_seqid->sequence->counter); | 831 | WRITE32(args->open_seqid->sequence->counter); |
832 | WRITEMEM(args->open_stateid->data, NFS4_STATEID_SIZE); | 832 | WRITEMEM(args->open_stateid->data, NFS4_STATEID_SIZE); |
833 | WRITE32(args->lock_seqid->sequence->counter); | 833 | WRITE32(args->lock_seqid->sequence->counter); |
834 | WRITE64(args->lock_owner.clientid); | 834 | WRITE64(args->lock_owner.clientid); |
835 | WRITE32(4); | 835 | WRITE32(16); |
836 | WRITE32(args->lock_owner.id); | 836 | WRITEMEM("lock id:", 8); |
837 | WRITE64(args->lock_owner.id); | ||
837 | } | 838 | } |
838 | else { | 839 | else { |
839 | RESERVE_SPACE(NFS4_STATEID_SIZE+4); | 840 | RESERVE_SPACE(NFS4_STATEID_SIZE+4); |
@@ -848,14 +849,15 @@ static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *arg | |||
848 | { | 849 | { |
849 | __be32 *p; | 850 | __be32 *p; |
850 | 851 | ||
851 | RESERVE_SPACE(40); | 852 | RESERVE_SPACE(52); |
852 | WRITE32(OP_LOCKT); | 853 | WRITE32(OP_LOCKT); |
853 | WRITE32(nfs4_lock_type(args->fl, 0)); | 854 | WRITE32(nfs4_lock_type(args->fl, 0)); |
854 | WRITE64(args->fl->fl_start); | 855 | WRITE64(args->fl->fl_start); |
855 | WRITE64(nfs4_lock_length(args->fl)); | 856 | WRITE64(nfs4_lock_length(args->fl)); |
856 | WRITE64(args->lock_owner.clientid); | 857 | WRITE64(args->lock_owner.clientid); |
857 | WRITE32(4); | 858 | WRITE32(16); |
858 | WRITE32(args->lock_owner.id); | 859 | WRITEMEM("lock id:", 8); |
860 | WRITE64(args->lock_owner.id); | ||
859 | 861 | ||
860 | return 0; | 862 | return 0; |
861 | } | 863 | } |
@@ -920,10 +922,11 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena | |||
920 | WRITE32(OP_OPEN); | 922 | WRITE32(OP_OPEN); |
921 | WRITE32(arg->seqid->sequence->counter); | 923 | WRITE32(arg->seqid->sequence->counter); |
922 | encode_share_access(xdr, arg->open_flags); | 924 | encode_share_access(xdr, arg->open_flags); |
923 | RESERVE_SPACE(16); | 925 | RESERVE_SPACE(28); |
924 | WRITE64(arg->clientid); | 926 | WRITE64(arg->clientid); |
925 | WRITE32(4); | 927 | WRITE32(16); |
926 | WRITE32(arg->id); | 928 | WRITEMEM("open id:", 8); |
929 | WRITE64(arg->id); | ||
927 | } | 930 | } |
928 | 931 | ||
929 | static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) | 932 | static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) |