From 80a80717215e2c4674f93571cbe0564dd4e987a5 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Wed, 14 Jun 2017 15:48:56 +0800 Subject: [PATCH] LU-9499 lfsck: set target bitmap properly If the notify from the peer server has LF_INCOMPLETE flags, then record it in the target bitmap unconditionally to avoid missing to update the bitmap for some corner cases. This patch also addes more debug information when the LFSCK updates the bitmap and handle double_scan_result. Lustre-change: https://review.whamcloud.com/27632 Lustre-commit: 775780cb90ba6069aefc7063adfe6862b26ce935 Signed-off-by: Fan Yong Change-Id: I3a6195136d608aa47e59e61f95c92978503e3a4b Reviewed-by: Lai Siyao Reviewed-by: Bobi Jam Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/28518 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond --- lustre/lfsck/lfsck_internal.h | 4 ++++ lustre/lfsck/lfsck_layout.c | 16 +++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lustre/lfsck/lfsck_internal.h b/lustre/lfsck/lfsck_internal.h index 3ab2472..61838f2 100644 --- a/lustre/lfsck/lfsck_internal.h +++ b/lustre/lfsck/lfsck_internal.h @@ -1434,6 +1434,10 @@ static inline void lfsck_lad_set_bitmap(const struct lu_env *env, ns->ln_flags |= LF_INCOMPLETE; } + + CDEBUG(D_LFSCK, "%s: %s LFSCK set bitmap (%p/%u) for idx %u\n", + lfsck_lfsck2name(com->lc_lfsck), lad->lad_name, bitmap, + bitmap->size, index); } static inline int lfsck_links_read(const struct lu_env *env, diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c index c445303..98360e16 100644 --- a/lustre/lfsck/lfsck_layout.c +++ b/lustre/lfsck/lfsck_layout.c @@ -1441,6 +1441,9 @@ static int lfsck_layout_double_scan_result(const struct lu_env *env, struct lfsck_instance *lfsck = com->lc_lfsck; struct lfsck_layout *lo = com->lc_file_ram; + CDEBUG(D_LFSCK, "%s: layout LFSCK double scan: rc = %d\n", + lfsck_lfsck2name(lfsck), rc); + down_write(&com->lc_sem); lo->ll_run_time_phase2 += cfs_duration_sec(cfs_time_current() + HALF_SEC - com->lc_time_last_checkpoint); @@ -1479,6 +1482,9 @@ static int lfsck_layout_double_scan_result(const struct lu_env *env, rc = lfsck_layout_store(env, com); up_write(&com->lc_sem); + CDEBUG(D_LFSCK, "%s: layout LFSCK double scan result %u: rc = %d\n", + lfsck_lfsck2name(lfsck), lo->ll_status, rc); + return rc; } @@ -6308,12 +6314,12 @@ static int lfsck_layout_master_in_notify(const struct lu_env *env, break; case LE_PHASE2_DONE: ltd->ltd_layout_done = 1; - if (!list_empty(<d->ltd_layout_list)) { + if (!list_empty(<d->ltd_layout_list)) list_del_init(<d->ltd_layout_list); - if (lr->lr_flags2 & LF_INCOMPLETE) { - lfsck_lad_set_bitmap(env, com, ltd->ltd_index); - fail = true; - } + + if (lr->lr_flags2 & LF_INCOMPLETE) { + lfsck_lad_set_bitmap(env, com, ltd->ltd_index); + fail = true; } break; -- 1.8.3.1