Whamcloud - gitweb
LU-10005 osp: cache non-exist EA 85/30585/2
authorDi Wang <di.wang@intel.com>
Fri, 27 Oct 2017 15:08:11 +0000 (23:08 +0800)
committerJohn L. Hammond <john.hammond@intel.com>
Thu, 12 Apr 2018 15:25:43 +0000 (15:25 +0000)
OSP should also cache non-exist EA, otherwise
it will keep sending RPC to try to get remote
non-exist EA.

So if default stripe EA does not exist on root
MDT, file creation on non-root MDT will always
try to send extra OSP RPC to get the EA.

This patch also fixes a LFSCK bug that may cause
the LFSCK repaired items to be counted repeately.

Test-Parameters: mdtfilesystemtype=ldiskfs ostfilesystemtype=ldiskfs mdscount=2 mdtcount=4 testlist=sanity-lfsck,sanity-lfsck,sanity-lfsck
Lustre-change: https://review.whamcloud.com/29078
Lustre-commit: b2fa448050aff0b5230c8cc94e8baf848fbb4ded

Signed-off-by: Di Wang <di.wang@intel.com>
Change-Id: Ie9c8cb5fd54e404f1af97de47e809f6f96de8d86
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Signed-off-by: Minh Diep <minh.diep@intel.com>
Reviewed-on: https://review.whamcloud.com/30585
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
lustre/lfsck/lfsck_internal.h
lustre/lfsck/lfsck_striped_dir.c
lustre/osp/osp_object.c

index 6c3c4f9..dfed008 100644 (file)
@@ -617,7 +617,8 @@ struct lfsck_lmv {
                                         ll_lmv_updated:1,
                                         ll_inline:1,
                                         ll_failed:1,
-                                        ll_ignore:1;
+                                        ll_ignore:1,
+                                        ll_counted:1;
        struct lfsck_slave_lmv_rec      *ll_lslr; /* may be vmalloc'd */
 };
 
index 8c3c286..1a5c48f 100644 (file)
@@ -1336,6 +1336,7 @@ int lfsck_namespace_notify_lmv_master_local(const struct lu_env *env,
                lfsck_lmv_put(env, llmv);
        } else {
                ns->ln_striped_dirs_repaired++;
+               llmv->ll_counted = 1;
                spin_lock(&lfsck->li_lock);
                list_add_tail(&llu->llu_link, &lfsck->li_list_lmv);
                spin_unlock(&lfsck->li_lock);
@@ -1919,7 +1920,8 @@ int lfsck_namespace_striped_dir_rescan(const struct lu_env *env,
                        RETURN(rc);
 
                ns->ln_striped_dirs_scanned++;
-               ns->ln_striped_dirs_repaired++;
+               if (!llmv->ll_counted)
+                       ns->ln_striped_dirs_repaired++;
        }
 
        fld_range_set_mdt(range);
index 0668475..0dc9b22 100644 (file)
@@ -1040,6 +1040,17 @@ unlock:
 
        rc = object_update_result_data_get(reply, rbuf, 0);
        if (rc < 0 || rbuf->lb_len == 0) {
+               if (oxe == NULL && rc == -ENODATA) {
+                       oxe = osp_oac_xattr_find_or_add(obj, name, buf->lb_len);
+                       if (oxe == NULL) {
+                               rc = -ENOMEM;
+                               CWARN("%s: Fail to add xattr (%s) to cache for "
+                                     DFID" (1): rc = %d\n", dname, name,
+                                     PFID(lu_object_fid(&dt->do_lu)), rc);
+                               GOTO(out, rc);
+                       }
+               }
+
                if (oxe) {
                        spin_lock(&obj->opo_lock);
                        if (unlikely(rc == -ENODATA)) {