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.4-RC1~49 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=3a59349d931250c3ea008a68f8f0121500d984a4 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 Lustre-change: https://review.whamcloud.com/29078 Lustre-commit: b2fa448050aff0b5230c8cc94e8baf848fbb4ded Signed-off-by: Di Wang Change-Id: Ie9c8cb5fd54e404f1af97de47e809f6f96de8d86 Reviewed-by: Fan Yong Tested-by: Andreas Dilger Reviewed-by: Lai Siyao Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/30585 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond --- diff --git a/lustre/lfsck/lfsck_internal.h b/lustre/lfsck/lfsck_internal.h index 6c3c4f9..dfed008 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 8c3c286..1a5c48f 100644 --- a/lustre/lfsck/lfsck_striped_dir.c +++ b/lustre/lfsck/lfsck_striped_dir.c @@ -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); diff --git a/lustre/osp/osp_object.c b/lustre/osp/osp_object.c index 0668475..0dc9b22 100644 --- a/lustre/osp/osp_object.c +++ b/lustre/osp/osp_object.c @@ -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)) {