Whamcloud - gitweb
LU-10912 mdc: use large xattr buffers for old servers 90/31990/3
authorJohn L. Hammond <john.hammond@intel.com>
Fri, 13 Apr 2018 15:57:28 +0000 (10:57 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 19 Apr 2018 04:37:40 +0000 (04:37 +0000)
Pre 2.10.1 MDTs will crash when they receive a listxattr (MDS_GETXATTR
with OBD_MD_FLXATTRLS) RPC for an orphan or dead object. So for
clients connected to these older MDTs, try to avoid sending listxattr
RPCs by making the bulk getxattr (MDS_GETXATTR with OBD_MD_FLXATTRALL)
more likely to succeed and thereby reducing the chances of falling
back to listxattr.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Ia96323c47c91a44495b73be2d95705298c7f7ac9
Reviewed-on: https://review.whamcloud.com/31990
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdc/mdc_locks.c

index bb1d0a3..b312a2f 100644 (file)
@@ -355,6 +355,7 @@ mdc_intent_getxattr_pack(struct obd_export *exp,
        struct ldlm_intent      *lit;
        int                     rc, count = 0;
        struct list_head        cancels = LIST_HEAD_INIT(cancels);
+       u32 min_buf_size = 0;
 
        ENTRY;
 
@@ -373,19 +374,36 @@ mdc_intent_getxattr_pack(struct obd_export *exp,
        lit = req_capsule_client_get(&req->rq_pill, &RMF_LDLM_INTENT);
        lit->opc = IT_GETXATTR;
 
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0)
+       /* If the supplied buffer is too small then the server will
+        * return -ERANGE and llite will fallback to using non cached
+        * xattr operations. On servers before 2.10.1 a (non-cached)
+        * listxattr RPC for an orphan or dead file causes an oops. So
+        * let's try to avoid sending too small a buffer to too old a
+        * server. This is effectively undoing the memory conservation
+        * of LU-9417 when it would be *more* likely to crash the
+        * server. See LU-9856. */
+       if (exp->exp_connect_data.ocd_version < OBD_OCD_VERSION(2, 10, 1, 0))
+               min_buf_size = exp->exp_connect_data.ocd_max_easize;
+#endif
+
        /* pack the intended request */
        mdc_pack_body(req, &op_data->op_fid1, op_data->op_valid,
-                     GA_DEFAULT_EA_NAME_LEN * GA_DEFAULT_EA_NUM,
+                     max_t(u32, min_buf_size,
+                         GA_DEFAULT_EA_NAME_LEN * GA_DEFAULT_EA_NUM),
                      -1, 0);
 
        req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_SERVER,
-                            GA_DEFAULT_EA_NAME_LEN * GA_DEFAULT_EA_NUM);
+                            max_t(u32, min_buf_size,
+                                GA_DEFAULT_EA_NAME_LEN * GA_DEFAULT_EA_NUM));
 
        req_capsule_set_size(&req->rq_pill, &RMF_EAVALS, RCL_SERVER,
-                            GA_DEFAULT_EA_VAL_LEN * GA_DEFAULT_EA_NUM);
+                            max_t(u32, min_buf_size,
+                                GA_DEFAULT_EA_VAL_LEN * GA_DEFAULT_EA_NUM));
 
        req_capsule_set_size(&req->rq_pill, &RMF_EAVALS_LENS, RCL_SERVER,
-                            sizeof(__u32) * GA_DEFAULT_EA_NUM);
+                            max_t(u32, min_buf_size,
+                                sizeof(__u32) * GA_DEFAULT_EA_NUM));
 
        req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER, 0);