From: Di Wang Date: Fri, 27 Oct 2017 15:08:11 +0000 (+0800) Subject: LU-10005 osp: cache non-exist EA X-Git-Tag: 2.10.57~87 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=b2fa448050aff0b5230c8cc94e8baf848fbb4ded;p=fs%2Flustre-release.git LU-10005 osp: cache non-exist EA 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 Change-Id: Ie9c8cb5fd54e404f1af97de47e809f6f96de8d86 Reviewed-on: https://review.whamcloud.com/29078 Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger Tested-by: Andreas Dilger Reviewed-by: Lai Siyao --- diff --git a/lustre/lfsck/lfsck_internal.h b/lustre/lfsck/lfsck_internal.h index a9df386..81dd74e 100644 --- a/lustre/lfsck/lfsck_internal.h +++ b/lustre/lfsck/lfsck_internal.h @@ -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 */ }; diff --git a/lustre/lfsck/lfsck_striped_dir.c b/lustre/lfsck/lfsck_striped_dir.c index 5ac0cb7..25f5cb2 100644 --- a/lustre/lfsck/lfsck_striped_dir.c +++ b/lustre/lfsck/lfsck_striped_dir.c @@ -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); diff --git a/lustre/osp/osp_object.c b/lustre/osp/osp_object.c index d67de46..d2ccc1b 100644 --- a/lustre/osp/osp_object.c +++ b/lustre/osp/osp_object.c @@ -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)) {