When the lfsck assistant thread hits some failure and exit
at the second stage scanning, it does not cleanup the requests
list 'lfsck_assistant_data::lad_req_list', that may cause the
lfsck main engine hit "LASSERT(list_empty(&lad->lad_req_list))"
when handles double scan.
This patch unifies the assistant thread exit process: before
cleanup the list 'lfsck_assistant_data::lad_req_list' set the
thread as "stopping" to prevent more lfsck requests being added,
then cleanup the list 'lfsck_assistant_data::lad_req_list'.
Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I7facd20e2742c7ad5d4fbee1c975dacd8f6ea363
Reviewed-on: http://review.whamcloud.com/22723
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
if (unlikely(lad->lad_exit ||
!thread_is_running(mthread)))
if (unlikely(lad->lad_exit ||
!thread_is_running(mthread)))
- GOTO(cleanup1, rc = lad->lad_post_result);
+ GOTO(cleanup, rc = lad->lad_post_result);
lar = list_entry(lad->lad_req_list.next,
struct lfsck_assistant_req,
lar = list_entry(lad->lad_req_list.next,
struct lfsck_assistant_req,
lao->la_req_fini(env, lar);
if (rc < 0 && bk->lb_param & LPF_FAILOUT)
lao->la_req_fini(env, lar);
if (rc < 0 && bk->lb_param & LPF_FAILOUT)
}
l_wait_event(athread->t_ctl_waitq,
}
l_wait_event(athread->t_ctl_waitq,
&lwi);
if (unlikely(lad->lad_exit))
&lwi);
if (unlikely(lad->lad_exit))
- GOTO(cleanup1, rc = lad->lad_post_result);
+ GOTO(cleanup, rc = lad->lad_post_result);
if (!list_empty(&lad->lad_req_list))
continue;
if (!list_empty(&lad->lad_req_list))
continue;
lfsck_lfsck2name(lfsck), lad->lad_name);
if (unlikely(lad->lad_exit))
lfsck_lfsck2name(lfsck), lad->lad_name);
if (unlikely(lad->lad_exit))
- GOTO(cleanup1, rc = lad->lad_post_result);
+ GOTO(cleanup, rc = lad->lad_post_result);
lad->lad_to_post = 0;
LASSERT(lad->lad_post_result > 0);
lad->lad_to_post = 0;
LASSERT(lad->lad_post_result > 0);
lfsck_lfsck2name(lfsck), rc2);
if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_NO_DOUBLESCAN))
lfsck_lfsck2name(lfsck), rc2);
if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_NO_DOUBLESCAN))
- GOTO(cleanup2, rc = 0);
while (lad->lad_in_double_scan) {
rc = lfsck_assistant_query_others(env, com);
while (lad->lad_in_double_scan) {
rc = lfsck_assistant_query_others(env, com);
goto p2_next;
if (rc < 0)
goto p2_next;
if (rc < 0)
/* Pull LFSCK status on related targets once
* per 30 seconds if we are not notified. */
/* Pull LFSCK status on related targets once
* per 30 seconds if we are not notified. */
if (unlikely(lad->lad_exit ||
!thread_is_running(mthread)))
if (unlikely(lad->lad_exit ||
!thread_is_running(mthread)))
- GOTO(cleanup2, rc = 0);
if (rc == -ETIMEDOUT)
continue;
if (rc < 0)
if (rc == -ETIMEDOUT)
continue;
if (rc < 0)
p2_next:
rc = lao->la_handler_p2(env, com);
if (rc != 0)
p2_next:
rc = lao->la_handler_p2(env, com);
if (rc != 0)
if (unlikely(lad->lad_exit ||
!thread_is_running(mthread)))
if (unlikely(lad->lad_exit ||
!thread_is_running(mthread)))
- GOTO(cleanup2, rc = 0);
/* Cleanup the unfinished requests. */
spin_lock(&lad->lad_lock);
if (rc < 0)
/* Cleanup the unfinished requests. */
spin_lock(&lad->lad_lock);
if (rc < 0)
if (lad->lad_exit && lad->lad_post_result <= 0)
lao->la_fill_pos(env, com, &lfsck->li_pos_checkpoint);
if (lad->lad_exit && lad->lad_post_result <= 0)
lao->la_fill_pos(env, com, &lfsck->li_pos_checkpoint);
+ thread_set_flags(athread, SVC_STOPPING);
while (!list_empty(&lad->lad_req_list)) {
lar = list_entry(lad->lad_req_list.next,
struct lfsck_assistant_req,
while (!list_empty(&lad->lad_req_list)) {
lar = list_entry(lad->lad_req_list.next,
struct lfsck_assistant_req,
LASSERTF(lad->lad_prefetched == 0, "unmatched prefeteched objs %d\n",
lad->lad_prefetched);
LASSERTF(lad->lad_prefetched == 0, "unmatched prefeteched objs %d\n",
lad->lad_prefetched);
memset(lr, 0, sizeof(*lr));
if (rc > 0) {
lr->lr_event = LE_PHASE2_DONE;
memset(lr, 0, sizeof(*lr));
if (rc > 0) {
lr->lr_event = LE_PHASE2_DONE;
struct lfsck_assistant_data *lad = com->lc_data;
struct lfsck_layout_req *llr;
struct lfsck_assistant_data *lad = com->lc_data;
struct lfsck_layout_req *llr;
+ if (((struct lfsck_layout *)(com->lc_file_ram))->ll_status !=
+ LS_SCANNING_PHASE1)
+ return;
+
if (list_empty(&lad->lad_req_list))
return;
if (list_empty(&lad->lad_req_list))
return;
struct lfsck_assistant_data *lad = com->lc_data;
struct lfsck_namespace_req *lnr;
struct lfsck_assistant_data *lad = com->lc_data;
struct lfsck_namespace_req *lnr;
+ if (((struct lfsck_namespace *)(com->lc_file_ram))->ln_status !=
+ LS_SCANNING_PHASE1)
+ return;
+
if (list_empty(&lad->lad_req_list))
return;
if (list_empty(&lad->lad_req_list))
return;