Whamcloud - gitweb
LU-212 reject connection with bad ocd_brw_size
authorhongchao.zhang <hongchao.zhang@whamcloud.com>
Sat, 2 Apr 2011 06:26:33 +0000 (14:26 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 19 Apr 2011 13:25:01 +0000 (06:25 -0700)
in obdfilter, rejecting connection request with -EPROTO if OBD_CONNECT_BRW_SIZE
is set in obd_connect_data->ocd_connect_flags, but "ocd_brw_size" in it is zero.

Change-Id: Iba002250a11ab7321dbb5d4f398dde5ebd00c11d
Signed-off-by: Hongchao Zhang <hongchao.zhang@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/431
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdfilter/filter.c

index 501652d..f60190d 100644 (file)
@@ -2704,7 +2704,18 @@ static int filter_connect_internal(struct obd_export *exp,
         } else if (data->ocd_connect_flags & OBD_CONNECT_BRW_SIZE) {
                 data->ocd_brw_size = min(data->ocd_brw_size,
                                (__u32)(PTLRPC_MAX_BRW_PAGES << CFS_PAGE_SHIFT));
         } else if (data->ocd_connect_flags & OBD_CONNECT_BRW_SIZE) {
                 data->ocd_brw_size = min(data->ocd_brw_size,
                                (__u32)(PTLRPC_MAX_BRW_PAGES << CFS_PAGE_SHIFT));
-                LASSERT(data->ocd_brw_size);
+                if (data->ocd_brw_size == 0) {
+                        CERROR("%s: cli %s/%p ocd_connect_flags: "LPX64
+                               " ocd_version: %x ocd_grant: %d ocd_index: %u "
+                               "ocd_brw_size is unexpectedly zero, "
+                               "network data corruption?"
+                               "Refusing connection of this client\n",
+                                exp->exp_obd->obd_name,
+                                exp->exp_client_uuid.uuid,
+                                exp, data->ocd_connect_flags, data->ocd_version,
+                                data->ocd_grant, data->ocd_index);
+                        RETURN(-EPROTO);
+                }
         }
 
         if (data->ocd_connect_flags & OBD_CONNECT_CKSUM) {
         }
 
         if (data->ocd_connect_flags & OBD_CONNECT_CKSUM) {