NFS: Fix bad defines of callback response maxsize
authorKinglong Mee <kinglongmee@gmail.com>
Thu, 24 Sep 2015 12:57:58 +0000 (20:57 +0800)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 21 Oct 2015 20:49:23 +0000 (15:49 -0500)
As CB_OP_TAGLEN_MAXSZ, all XXX_MAXSZ should be defined as bit.
Each operation should not cantains CB_OP_TAGLEN_MAXSZ.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/callback_xdr.c

index 09aeb9a47dac50f22ca01cac82f48544bc492f75..9f0f0f646eaf0d11789339cbb782650cb37c018a 100644 (file)
 #include "internal.h"
 #include "nfs4session.h"
 
-#define CB_OP_TAGLEN_MAXSZ     (512)
-#define CB_OP_HDR_RES_MAXSZ    (2 + CB_OP_TAGLEN_MAXSZ)
-#define CB_OP_GETATTR_BITMAP_MAXSZ     (4)
-#define CB_OP_GETATTR_RES_MAXSZ        (CB_OP_HDR_RES_MAXSZ + \
-                               CB_OP_GETATTR_BITMAP_MAXSZ + \
-                               2 + 2 + 3 + 3)
-#define CB_OP_RECALL_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
+#define CB_OP_TAGLEN_MAXSZ             (512)
+#define CB_OP_HDR_RES_MAXSZ            (2 * 4) // opcode, status
+#define CB_OP_GETATTR_BITMAP_MAXSZ     (4 * 4) // bitmap length, 3 bitmaps
+#define CB_OP_GETATTR_RES_MAXSZ                (CB_OP_HDR_RES_MAXSZ + \
+                                        CB_OP_GETATTR_BITMAP_MAXSZ + \
+                                        /* change, size, ctime, mtime */\
+                                        (2 + 2 + 3 + 3) * 4)
+#define CB_OP_RECALL_RES_MAXSZ         (CB_OP_HDR_RES_MAXSZ)
 
 #if defined(CONFIG_NFS_V4_1)
 #define CB_OP_LAYOUTRECALL_RES_MAXSZ   (CB_OP_HDR_RES_MAXSZ)
 #define CB_OP_DEVICENOTIFY_RES_MAXSZ   (CB_OP_HDR_RES_MAXSZ)
 #define CB_OP_SEQUENCE_RES_MAXSZ       (CB_OP_HDR_RES_MAXSZ + \
-                                       4 + 1 + 3)
+                                        NFS4_MAX_SESSIONID_LEN + \
+                                        (1 + 3) * 4) // seqid, 3 slotids
 #define CB_OP_RECALLANY_RES_MAXSZ      (CB_OP_HDR_RES_MAXSZ)
 #define CB_OP_RECALLSLOT_RES_MAXSZ     (CB_OP_HDR_RES_MAXSZ)
 #endif /* CONFIG_NFS_V4_1 */