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>
This commit is contained in:
@@ -68,10 +68,10 @@ static int nfs4_stat_to_errno(int);
|
||||
#endif
|
||||
|
||||
/* lock,open owner id:
|
||||
* we currently use size 1 (u32) out of (NFS4_OPAQUE_LIMIT >> 2)
|
||||
* we currently use size 2 (u64) out of (NFS4_OPAQUE_LIMIT >> 2)
|
||||
*/
|
||||
#define open_owner_id_maxsz (1 + 1)
|
||||
#define lock_owner_id_maxsz (1 + 1)
|
||||
#define open_owner_id_maxsz (1 + 4)
|
||||
#define lock_owner_id_maxsz (1 + 4)
|
||||
#define compound_encode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2))
|
||||
#define compound_decode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2))
|
||||
#define op_encode_hdr_maxsz (1)
|
||||
@@ -827,13 +827,14 @@ static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args)
|
||||
WRITE64(nfs4_lock_length(args->fl));
|
||||
WRITE32(args->new_lock_owner);
|
||||
if (args->new_lock_owner){
|
||||
RESERVE_SPACE(4+NFS4_STATEID_SIZE+20);
|
||||
RESERVE_SPACE(4+NFS4_STATEID_SIZE+32);
|
||||
WRITE32(args->open_seqid->sequence->counter);
|
||||
WRITEMEM(args->open_stateid->data, NFS4_STATEID_SIZE);
|
||||
WRITE32(args->lock_seqid->sequence->counter);
|
||||
WRITE64(args->lock_owner.clientid);
|
||||
WRITE32(4);
|
||||
WRITE32(args->lock_owner.id);
|
||||
WRITE32(16);
|
||||
WRITEMEM("lock id:", 8);
|
||||
WRITE64(args->lock_owner.id);
|
||||
}
|
||||
else {
|
||||
RESERVE_SPACE(NFS4_STATEID_SIZE+4);
|
||||
@@ -848,14 +849,15 @@ static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *arg
|
||||
{
|
||||
__be32 *p;
|
||||
|
||||
RESERVE_SPACE(40);
|
||||
RESERVE_SPACE(52);
|
||||
WRITE32(OP_LOCKT);
|
||||
WRITE32(nfs4_lock_type(args->fl, 0));
|
||||
WRITE64(args->fl->fl_start);
|
||||
WRITE64(nfs4_lock_length(args->fl));
|
||||
WRITE64(args->lock_owner.clientid);
|
||||
WRITE32(4);
|
||||
WRITE32(args->lock_owner.id);
|
||||
WRITE32(16);
|
||||
WRITEMEM("lock id:", 8);
|
||||
WRITE64(args->lock_owner.id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -920,10 +922,11 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena
|
||||
WRITE32(OP_OPEN);
|
||||
WRITE32(arg->seqid->sequence->counter);
|
||||
encode_share_access(xdr, arg->open_flags);
|
||||
RESERVE_SPACE(16);
|
||||
RESERVE_SPACE(28);
|
||||
WRITE64(arg->clientid);
|
||||
WRITE32(4);
|
||||
WRITE32(arg->id);
|
||||
WRITE32(16);
|
||||
WRITEMEM("open id:", 8);
|
||||
WRITE64(arg->id);
|
||||
}
|
||||
|
||||
static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg)
|
||||
|
Reference in New Issue
Block a user