Whamcloud - gitweb
LU-10005 osp: cache non-exist EA 78/29078/9
authorDi Wang <di.wang@intel.com>
Fri, 27 Oct 2017 15:08:11 +0000 (23:08 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 17 Dec 2017 06:21:03 +0000 (06:21 +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
Signed-off-by: Di Wang <di.wang@intel.com>
Change-Id: Ie9c8cb5fd54e404f1af97de47e809f6f96de8d86
Reviewed-on: https://review.whamcloud.com/29078
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
lustre/lfsck/lfsck_internal.h
lustre/lfsck/lfsck_striped_dir.c
lustre/osp/osp_object.c

index a9df386..81dd74e 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 5ac0cb7..25f5cb2 100644 (file)
@@ -1318,6 +1318,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);
@@ -1901,7 +1902,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 d67de46..d2ccc1b 100644 (file)
@@ -1017,6 +1017,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)) {