GOTO(out, rc = PTR_ERR(di));
rc = iops->load(env, di, cookie);
- if (rc == 0 || (rc > 0 && cookie > 0))
+ if (rc == -ENODATA)
+ rc = 1;
+ else if (rc == 0 || (rc > 0 && cookie > 0))
rc = iops->next(env, di);
else if (rc > 0)
rc = 0;
int rc = 0;
int rc1 = 0;
- if (likely(cfs_time_beforeq(cfs_time_current(),
- lfsck->li_time_next_checkpoint)))
+ if (likely(ktime_get_seconds() <= lfsck->li_time_next_checkpoint))
return 0;
lfsck_pos_fill(env, lfsck, &lfsck->li_pos_checkpoint, false);
rc1 = rc;
}
- lfsck->li_time_last_checkpoint = cfs_time_current();
+ lfsck->li_time_last_checkpoint = ktime_get_seconds();
lfsck->li_time_next_checkpoint = lfsck->li_time_last_checkpoint +
- cfs_time_seconds(LFSCK_CHECKPOINT_INTERVAL);
+ LFSCK_CHECKPOINT_INTERVAL;
return rc1 != 0 ? rc1 : rc;
}
/* Init otable-based iterator. */
if (pos == NULL) {
rc = iops->load(env, lfsck->li_di_oit, 0);
- if (rc > 0) {
+ if (rc > 0 || unlikely(rc == -ENODATA)) {
lfsck->li_oit_over = 1;
rc = 0;
}
}
rc = iops->load(env, lfsck->li_di_oit, pos->lp_oit_cookie);
- if (rc < 0)
- GOTO(out, rc);
- else if (rc > 0)
+ if (rc > 0 || unlikely(rc == -ENODATA))
lfsck->li_oit_over = 1;
+ else if (rc < 0)
+ GOTO(out, rc);
if (!lfsck->li_master || fid_is_zero(&pos->lp_dir_parent))
GOTO(out, rc = 0);
break;
}
- lfsck->li_time_last_checkpoint = cfs_time_current();
+ lfsck->li_time_last_checkpoint = ktime_get_seconds();
lfsck->li_time_next_checkpoint = lfsck->li_time_last_checkpoint +
- cfs_time_seconds(LFSCK_CHECKPOINT_INTERVAL);
+ LFSCK_CHECKPOINT_INTERVAL;
return rc;
}
(__u32)com->lc_type, rc);
}
- lfsck->li_time_last_checkpoint = cfs_time_current();
+ lfsck->li_time_last_checkpoint = ktime_get_seconds();
lfsck->li_time_next_checkpoint = lfsck->li_time_last_checkpoint +
- cfs_time_seconds(LFSCK_CHECKPOINT_INTERVAL);
+ LFSCK_CHECKPOINT_INTERVAL;
/* Ignore some component post failure to make other can go ahead. */
return result;
int rc;
ENTRY;
+ spin_lock(&lfsck->li_lock);
+ lfsck->li_task = current;
+ spin_unlock(&lfsck->li_lock);
+
/* There will be some objects verification during the LFSCK start,
* such as the subsequent lfsck_verify_lpf(). Trigger low layer OI
* OI scrub before that to handle the potential inconsistence. */
current_pid());
spin_lock(&lfsck->li_lock);
+ if (unlikely(!thread_is_starting(thread))) {
+ spin_unlock(&lfsck->li_lock);
+ GOTO(fini_oit, rc = 0);
+ }
+
thread_set_flags(thread, SVC_RUNNING);
spin_unlock(&lfsck->li_lock);
wake_up_all(&thread->t_ctl_waitq);
fini_args:
spin_lock(&lfsck->li_lock);
thread_set_flags(thread, SVC_STOPPED);
+ lfsck->li_task = NULL;
spin_unlock(&lfsck->li_lock);
wake_up_all(&thread->t_ctl_waitq);
lfsck_thread_args_fini(lta);
}
spin_unlock(<ds->ltd_lock);
- rc = ptlrpc_set_wait(set);
+ rc = ptlrpc_set_wait(env, set);
if (rc < 0) {
ptlrpc_set_destroy(set);
RETURN(rc);
up_read(<ds->ltd_rw_sem);
/* Sync up */
- rc = ptlrpc_set_wait(set);
+ rc = ptlrpc_set_wait(env, set);
if (rc < 0) {
ptlrpc_set_destroy(set);
RETURN(rc);
}
spin_unlock(<ds->ltd_lock);
- rc = ptlrpc_set_wait(set);
+ rc = ptlrpc_set_wait(env, set);
if (rc < 0) {
ptlrpc_set_destroy(set);
RETURN(rc);
break;
}
- rc1 = ptlrpc_set_wait(set);
+ rc1 = ptlrpc_set_wait(env, set);
ptlrpc_set_destroy(set);
RETURN(rc != 0 ? rc : rc1);
com->lc_new_checked = 0;
com->lc_new_scanned = 0;
- com->lc_time_last_checkpoint = cfs_time_current();
+ com->lc_time_last_checkpoint = ktime_get_seconds();
com->lc_time_next_checkpoint =
com->lc_time_last_checkpoint +
- cfs_time_seconds(LFSCK_CHECKPOINT_INTERVAL);
+ LFSCK_CHECKPOINT_INTERVAL;
CDEBUG(D_LFSCK, "%s: LFSCK assistant sync before "
"the second-stage scaning\n",
}
spin_unlock(&lad->lad_lock);
- 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;
spin_lock(&lad->lad_lock);
lad->lad_assistant_status = (rc1 != 0 ? rc1 : rc);
thread_set_flags(athread, SVC_STOPPED);
- wake_up_all(&mthread->t_ctl_waitq);
lad->lad_task = NULL;
spin_unlock(&lad->lad_lock);
lad->lad_assistant_status);
lfsck_thread_args_fini(lta);
+ wake_up_all(&mthread->t_ctl_waitq);
return rc;
}