* [PATCH 0/2] fix getdevice{info,list} xdr decode sizing
@ 2010-09-02 7:57 Benny Halevy
2010-09-02 7:58 ` [PATCH 1/2] SQUASHME: pnfs-submit: fix getdeviceinfo " Benny Halevy
2010-09-02 7:59 ` [PATCH 2/2] SQUASHME: pnfs-submit: fix getdevicelist " Benny Halevy
0 siblings, 2 replies; 3+ messages in thread
From: Benny Halevy @ 2010-09-02 7:57 UTC (permalink / raw)
To: NFS list
looks like encode_getdevice{info,list} went under the radar and they
do not update hdr->replen.
decode_getdeviceinfo_maxsz was completely screwed up so that twas fixed
along with the replen calculation for the deviceinfo's xdr_inline_pages.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] SQUASHME: pnfs-submit: fix getdeviceinfo decode sizing
2010-09-02 7:57 [PATCH 0/2] fix getdevice{info,list} xdr decode sizing Benny Halevy
@ 2010-09-02 7:58 ` Benny Halevy
2010-09-02 7:59 ` [PATCH 2/2] SQUASHME: pnfs-submit: fix getdevicelist " Benny Halevy
1 sibling, 0 replies; 3+ messages in thread
From: Benny Halevy @ 2010-09-02 7:58 UTC (permalink / raw)
To: linux-nfs
it looks like we forgot to adjust hdr->replen in
encode_getdeviceinfo (and encode_getdevicelist).
and decode_getdeviceinfo_maxsz is completely wrong!
It's in bytes, not words as it should be.
Ironically, this balanced the -8 bug above in computing replen
for xdi_inline_pages
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
fs/nfs/nfs4xdr.c | 24 ++++++++++--------------
1 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 42a91c9..c422964 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -325,10 +325,11 @@ static int nfs4_stat_to_errno(int);
#define encode_getdeviceinfo_maxsz (op_encode_hdr_maxsz + 4 + \
XDR_QUADLEN(NFS4_PNFS_DEVICEID4_SIZE))
#define decode_getdeviceinfo_maxsz (op_decode_hdr_maxsz + \
- 4 /*layout type */ + \
- 4 /* opaque devaddr4 length */ +\
- 4 /* notification bitmap length */ + \
- 4 /* notification bitmap */)
+ 1 /* layout type */ + \
+ 1 /* opaque devaddr4 length */ + \
+ /* devaddr4 payload is read into page */ \
+ 1 /* notification bitmap length */ + \
+ 1 /* notification bitmap */)
#define encode_layoutget_maxsz (op_encode_hdr_maxsz + 10 + \
encode_stateid_maxsz)
#define decode_layoutget_maxsz (op_decode_hdr_maxsz + 8 + \
@@ -1888,6 +1889,7 @@ encode_getdeviceinfo(struct xdr_stream *xdr,
if (has_bitmap)
*p = cpu_to_be32(args->pdev->dev_notify_types);
hdr->nops++;
+ hdr->replen += decode_getdeviceinfo_maxsz;
}
static void
@@ -2850,26 +2852,20 @@ static int nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req, uint32_t *p,
struct nfs4_getdeviceinfo_args *args)
{
struct xdr_stream xdr;
- struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
- int replen;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_compound_hdr(&xdr, req, &hdr);
encode_sequence(&xdr, &args->seq_args, &hdr);
encode_getdeviceinfo(&xdr, args, &hdr);
- /* set up reply kvec. Subtract notification bitmap max size (8)
+ /* set up reply kvec. Subtract notification bitmap max size (2)
* so that notification bitmap is put in xdr_buf tail */
- replen = (RPC_REPHDRSIZE + auth->au_rslack +
- NFS4_dec_getdeviceinfo_sz - 8) << 2;
- xdr_inline_pages(&req->rq_rcv_buf, replen, args->pdev->pages,
- args->pdev->pgbase, args->pdev->pglen);
- dprintk("%s: inlined page args = (%u, %p, %u, %u)\n",
- __func__, replen, args->pdev->pages,
- args->pdev->pgbase, args->pdev->pglen);
+ xdr_inline_pages(&req->rq_rcv_buf, (hdr.replen - 2) << 2,
+ args->pdev->pages, args->pdev->pgbase,
+ args->pdev->pglen);
encode_nops(&hdr);
return 0;
--
1.7.2.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] SQUASHME: pnfs-submit: fix getdevicelist decode sizing
2010-09-02 7:57 [PATCH 0/2] fix getdevice{info,list} xdr decode sizing Benny Halevy
2010-09-02 7:58 ` [PATCH 1/2] SQUASHME: pnfs-submit: fix getdeviceinfo " Benny Halevy
@ 2010-09-02 7:59 ` Benny Halevy
1 sibling, 0 replies; 3+ messages in thread
From: Benny Halevy @ 2010-09-02 7:59 UTC (permalink / raw)
To: linux-nfs
it looks like we forgot to adjust hdr->replen in
encode_getdevicelist.
spell out the fields for decode_getdevicelist_maxsz.
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
fs/nfs/nfs4xdr.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index c422964..398951e 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -318,10 +318,15 @@ static int nfs4_stat_to_errno(int);
#define decode_reclaim_complete_maxsz (op_decode_hdr_maxsz + 4)
#define encode_getdevicelist_maxsz (op_encode_hdr_maxsz + 4 + \
encode_verifier_maxsz)
-#define decode_getdevicelist_maxsz (op_decode_hdr_maxsz + 2 + 1 + 1 + \
- decode_verifier_maxsz + \
- XDR_QUADLEN(NFS4_PNFS_GETDEVLIST_MAXNUM * \
- NFS4_PNFS_DEVICEID4_SIZE))
+#define decode_getdevicelist_maxsz (op_decode_hdr_maxsz + \
+ 2 /* nfs_cookie4 gdlr_cookie */ + \
+ decode_verifier_maxsz \
+ /* verifier4 gdlr_verifier */ + \
+ 1 /* gdlr_deviceid_list count */ + \
+ XDR_QUADLEN(NFS4_PNFS_GETDEVLIST_MAXNUM * \
+ NFS4_PNFS_DEVICEID4_SIZE) \
+ /* gdlr_deviceid_list */ + \
+ 1 /* bool gdlr_eof */)
#define encode_getdeviceinfo_maxsz (op_encode_hdr_maxsz + 4 + \
XDR_QUADLEN(NFS4_PNFS_DEVICEID4_SIZE))
#define decode_getdeviceinfo_maxsz (op_decode_hdr_maxsz + \
@@ -1868,6 +1873,7 @@ encode_getdevicelist(struct xdr_stream *xdr,
xdr_encode_hyper(p, 0ULL); /* cookie */
encode_nfs4_verifier(xdr, &dummy);
hdr->nops++;
+ hdr->replen += decode_getdevicelist_maxsz;
}
static void
--
1.7.2.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-02 7:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-02 7:57 [PATCH 0/2] fix getdevice{info,list} xdr decode sizing Benny Halevy
2010-09-02 7:58 ` [PATCH 1/2] SQUASHME: pnfs-submit: fix getdeviceinfo " Benny Halevy
2010-09-02 7:59 ` [PATCH 2/2] SQUASHME: pnfs-submit: fix getdevicelist " Benny Halevy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox