Commit a8bb84bc authored by Kinglong Mee's avatar Kinglong Mee Committed by J. Bruce Fields

nfsd: calculate the missing length of bitmap in EXCHANGE_ID

commit 58cd57bf
"nfsd: Fix SP4_MACH_CRED negotiation in EXCHANGE_ID"
miss calculating the length of bitmap for spo_must_enforce and spo_must_allow.
Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent c4fa6d7c
...@@ -1524,7 +1524,8 @@ static inline u32 nfsd4_write_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) ...@@ -1524,7 +1524,8 @@ static inline u32 nfsd4_write_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
{ {
return (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\ return (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\
1 + 1 + 2 + /* eir_flags, spr_how, spo_must_enforce & _allow */\ 1 + 1 + /* eir_flags, spr_how */\
4 + /* spo_must_enforce & _allow with bitmap */\
2 + /*eir_server_owner.so_minor_id */\ 2 + /*eir_server_owner.so_minor_id */\
/* eir_server_owner.so_major_id<> */\ /* eir_server_owner.so_major_id<> */\
XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 +\ XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 +\
......
...@@ -3398,35 +3398,43 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr, ...@@ -3398,35 +3398,43 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr,
8 /* eir_clientid */ + 8 /* eir_clientid */ +
4 /* eir_sequenceid */ + 4 /* eir_sequenceid */ +
4 /* eir_flags */ + 4 /* eir_flags */ +
4 /* spr_how */ + 4 /* spr_how */);
8 /* spo_must_enforce, spo_must_allow */ +
8 /* so_minor_id */ +
4 /* so_major_id.len */ +
(XDR_QUADLEN(major_id_sz) * 4) +
4 /* eir_server_scope.len */ +
(XDR_QUADLEN(server_scope_sz) * 4) +
4 /* eir_server_impl_id.count (0) */);
WRITEMEM(&exid->clientid, 8); WRITEMEM(&exid->clientid, 8);
WRITE32(exid->seqid); WRITE32(exid->seqid);
WRITE32(exid->flags); WRITE32(exid->flags);
WRITE32(exid->spa_how); WRITE32(exid->spa_how);
ADJUST_ARGS();
switch (exid->spa_how) { switch (exid->spa_how) {
case SP4_NONE: case SP4_NONE:
break; break;
case SP4_MACH_CRED: case SP4_MACH_CRED:
/* spo_must_enforce, spo_must_allow */
RESERVE_SPACE(16);
/* spo_must_enforce bitmap: */ /* spo_must_enforce bitmap: */
WRITE32(2); WRITE32(2);
WRITE32(nfs4_minimal_spo_must_enforce[0]); WRITE32(nfs4_minimal_spo_must_enforce[0]);
WRITE32(nfs4_minimal_spo_must_enforce[1]); WRITE32(nfs4_minimal_spo_must_enforce[1]);
/* empty spo_must_allow bitmap: */ /* empty spo_must_allow bitmap: */
WRITE32(0); WRITE32(0);
ADJUST_ARGS();
break; break;
default: default:
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
} }
RESERVE_SPACE(
8 /* so_minor_id */ +
4 /* so_major_id.len */ +
(XDR_QUADLEN(major_id_sz) * 4) +
4 /* eir_server_scope.len */ +
(XDR_QUADLEN(server_scope_sz) * 4) +
4 /* eir_server_impl_id.count (0) */);
/* The server_owner struct */ /* The server_owner struct */
WRITE64(minor_id); /* Minor id */ WRITE64(minor_id); /* Minor id */
/* major id */ /* major id */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment