From 7c82a9c81d03dec059132dddafd0bdde188b321d Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Sun, 30 Nov 2014 08:22:10 +0800 Subject: [PATCH] LU-6230 lfsck: reload OSP-object via set LOV EA on LOD-object Generally, we should use bottom device (OSD) to update parent LOV EA. But because the LOD-object still references the wrong OSP-object that should be detached after the parent's LOV EA refreshed. Unfortunately, there is no suitable API for that. So we have to make the LOD to re-load the OSP-object(s) via replacing the LOV EA against the LOD-object. Once the DNE2 patches have been landed, we can replace the LOD device with the OSD device. Signed-off-by: Fan Yong Change-Id: I960f42dacc8ee23dd98a2b986f0a83cb53b62c15 Reviewed-on: http://review.whamcloud.com/13848 Reviewed-by: Andreas Dilger Tested-by: Jenkins Reviewed-by: wangdi Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/lfsck/lfsck_layout.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c index bd2e1d7..2100784 100644 --- a/lustre/lfsck/lfsck_layout.c +++ b/lustre/lfsck/lfsck_layout.c @@ -2885,6 +2885,7 @@ static int lfsck_layout_repair_multiple_references(const struct lu_env *env, struct thandle *handle = NULL; struct lov_mds_md_v1 *lmm; struct lov_ost_data_v1 *objs; + const struct lu_fid *pfid = lfsck_dto2fid(parent); struct lu_fid tfid; struct lustre_handle lh = { 0 }; struct lu_buf ea_buf; @@ -2946,6 +2947,22 @@ static int lfsck_layout_repair_multiple_references(const struct lu_env *env, GOTO(log, rc); /* The 2nd transaction. */ + + /* XXX: Generally, we should use bottom device (OSD) to update parent + * LOV EA. But because the LOD-object still references the wrong + * OSP-object that should be detached after the parent's LOV EA + * refreshed. Unfortunately, there is no suitable API for that. + * So we have to make the LOD to re-load the OSP-object(s) via + * replacing the LOV EA against the LOD-object. + * + * Once the DNE2 patches have been landed, we can replace the + * LOD device with the OSD device. LU-6230. */ + + dev = lfsck->li_next; + parent = lfsck_object_locate(dev, parent); + if (IS_ERR(parent)) + GOTO(log, rc = PTR_ERR(parent)); + handle = dt_trans_create(env, dev); if (IS_ERR(handle)) GOTO(log, rc = PTR_ERR(handle)); @@ -2999,14 +3016,7 @@ static int lfsck_layout_repair_multiple_references(const struct lu_env *env, rc = dt_xattr_set(env, parent, &ea_buf, XATTR_NAME_LOV, LU_XATTR_REPLACE, handle, BYPASS_CAPA); - if (rc == 0) { - /* The @parent LOV EA has been updated, need to be re-loaded. */ - set_bit(LU_OBJECT_HEARD_BANSHEE, - &parent->do_lu.lo_header->loh_flags); - rc = 1; - } - - GOTO(unlock, rc); + GOTO(unlock, rc = (rc == 0 ? 1 : rc)); unlock: dt_write_unlock(env, parent); @@ -3022,8 +3032,7 @@ log: CDEBUG(D_LFSCK, "%s: layout LFSCK assistant repaired multiple " "references for: parent "DFID", OST-index %u, stripe-index %u, " - "owner %u/%u: rc = %d\n", - lfsck_lfsck2name(lfsck), PFID(lfsck_dto2fid(parent)), + "owner %u/%u: rc = %d\n", lfsck_lfsck2name(lfsck), PFID(pfid), llr->llr_ost_idx, llr->llr_lov_idx, la->la_uid, la->la_gid, rc); return rc; -- 1.8.3.1