enum {
OBDF_ATTACHED, /* finished attach */
OBDF_SET_UP, /* finished setup */
+ OBDF_RECOVERING, /* there are recoverable clients */
OBDF_NUM_FLAGS,
};
/* bitfield modification is protected by obd_dev_lock */
DECLARE_BITMAP(obd_flags, OBDF_NUM_FLAGS);
unsigned long
- obd_recovering:1, /* there are recoverable clients */
obd_abort_recovery:1, /* abort client and MDT recovery */
obd_abort_mdt_recovery:1, /* abort recovery between MDTs */
obd_version_recov:1, /* obd uses version checking */
ktime_t remaining;
s64 timeout;
- if (!target->obd_recovering || target->obd_recovery_start == 0)
+ if (!test_bit(OBDF_RECOVERING, target->obd_flags) ||
+ target->obd_recovery_start == 0)
return 0;
remaining = hrtimer_get_remaining(&target->obd_recovery_timer);
* the recovery of the whole cluster.
*/
spin_lock(&target->obd_dev_lock);
- if (target->obd_recovering) {
+ if (test_bit(OBDF_RECOVERING, target->obd_flags)) {
CERROR("%s: Aborting recovery\n", target->obd_name);
target->obd_abort_recovery = 1;
wake_up(&target->obd_next_transno_waitq);
RETURN(-EALREADY);
}
- if (!target->obd_recovering) {
+ if (!test_bit(OBDF_RECOVERING, target->obd_flags)) {
LCONSOLE_WARN("%s: Client %s (at %s) reconnecting\n",
target->obd_name, obd_uuid2str(&exp->exp_client_uuid),
obd_export_nid2str(exp));
CDEBUG(D_HA, "%s: connection from %s@%s %st%llu exp %p cur %lld last %lld\n",
target->obd_name, cluuid.uuid, libcfs_nidstr(&req->rq_peer.nid),
- target->obd_recovering ? "recovering/" : "", data->ocd_transno,
+ test_bit(OBDF_RECOVERING, target->obd_flags) ? "recovering/" : "", data->ocd_transno,
export, ktime_get_seconds(),
export ? export->exp_last_request_time : 0);
* If this is the first time a client connects, reset the recovery
* timer. Discard lightweight connections which might be local.
*/
- if (!lw_client && rc == 0 && target->obd_recovering)
+ if (!lw_client && rc == 0 && test_bit(OBDF_RECOVERING, target->obd_flags))
check_and_start_recovery_timer(target, req, export == NULL);
/*
* allow "new" MDT to be connected during recovery, since we
* need retrieve recovery update records from it
*/
- if (target->obd_recovering && !lw_client && !mds_mds_conn) {
+ if (test_bit(OBDF_RECOVERING, target->obd_flags) &&
+ !lw_client && !mds_mds_conn) {
struct hrtimer *timer = &target->obd_recovery_timer;
ktime_t remaining;
s64 timeout, left;
if (rc != 0)
GOTO(out, rc);
- if (target->obd_recovering && !export->exp_in_recovery && !lw_client) {
+ if (test_bit(OBDF_RECOVERING, target->obd_flags) &&
+ !export->exp_in_recovery && !lw_client) {
int has_transno;
__u64 transno = data->ocd_transno;
}
/* Tell the client we're in recovery, when client is involved in it. */
- if (target->obd_recovering && !lw_client)
+ if (test_bit(OBDF_RECOVERING, target->obd_flags) && !lw_client)
lustre_msg_add_op_flags(req->rq_repmsg, MSG_CONNECT_RECOVERING);
out:
LIST_HEAD(clean_list);
spin_lock(&obd->obd_dev_lock);
- if (!obd->obd_recovering) {
+ if (!test_bit(OBDF_RECOVERING, obd->obd_flags)) {
spin_unlock(&obd->obd_dev_lock);
EXIT;
return;
}
- obd->obd_recovering = 0;
+ clear_bit(OBDF_RECOVERING, obd->obd_flags);
obd->obd_abort_recovery = 0;
obd->obd_abort_mdt_recovery = 0;
spin_unlock(&obd->obd_dev_lock);
return;
spin_lock(&obd->obd_dev_lock);
- if (!obd->obd_recovering || obd->obd_abort_recovery) {
+ if (!test_bit(OBDF_RECOVERING, obd->obd_flags) || obd->obd_abort_recovery) {
spin_unlock(&obd->obd_dev_lock);
return;
}
timeout_t left;
spin_lock(&obd->obd_dev_lock);
- if (!obd->obd_recovering || obd->obd_abort_recovery ||
+ if (!test_bit(OBDF_RECOVERING, obd->obd_flags) || obd->obd_abort_recovery ||
obd->obd_stopping) {
spin_unlock(&obd->obd_dev_lock);
return;
time64_t last = 0;
time64_t now;
repeat:
- if (obd->obd_recovering && obd->obd_recovery_start == 0) {
+ if (test_bit(OBDF_RECOVERING, obd->obd_flags) && obd->obd_recovery_start == 0) {
now = ktime_get_seconds();
if (now - last > 600) {
LCONSOLE_INFO("%s: in recovery but waiting for the first client to connect\n",
trd->trd_processing_task = current->pid;
spin_lock(&obd->obd_dev_lock);
- obd->obd_recovering = 1;
+ set_bit(OBDF_RECOVERING, obd->obd_flags);
spin_unlock(&obd->obd_dev_lock);
complete(&trd->trd_starting);
* to regular mds_handle() since now
*/
spin_lock(&obd->obd_dev_lock);
- obd->obd_recovering = 0;
+ clear_bit(OBDF_RECOVERING, obd->obd_flags);
obd->obd_abort_recovery = 0;
obd->obd_abort_mdt_recovery = 0;
spin_unlock(&obd->obd_dev_lock);
if (!IS_ERR(kthread_run(target_recovery_thread,
lut, "tgt_recover_%d", index))) {
wait_for_completion(&trd->trd_starting);
- LASSERT(obd->obd_recovering != 0);
+ LASSERT(test_bit(OBDF_RECOVERING, obd->obd_flags));
} else {
rc = -ECHILD;
}
struct target_recovery_data *trd = &obd->obd_recovery_data;
/** recovery can be done but postrecovery is not yet */
spin_lock(&obd->obd_dev_lock);
- if (obd->obd_recovering) {
+ if (test_bit(OBDF_RECOVERING, obd->obd_flags)) {
CERROR("%s: Aborting recovery\n", obd->obd_name);
obd->obd_abort_recovery = 1;
wake_up(&obd->obd_next_transno_waitq);
DEBUG_REQ(D_HA, req, "queue final req");
wake_up(&obd->obd_next_transno_waitq);
spin_lock(&obd->obd_recovery_task_lock);
- if (obd->obd_recovering) {
+ if (test_bit(OBDF_RECOVERING, obd->obd_flags)) {
struct ptlrpc_request *tmp;
struct ptlrpc_request *duplicate = NULL;
DEBUG_REQ(D_HA, req, "queue lock replay req");
wake_up(&obd->obd_next_transno_waitq);
spin_lock(&obd->obd_recovery_task_lock);
- LASSERT(obd->obd_recovering);
+ LASSERT(test_bit(OBDF_RECOVERING, obd->obd_flags));
/* usually due to recovery abort */
if (!req->rq_export->exp_in_recovery) {
spin_unlock(&obd->obd_recovery_task_lock);
/* XXX O(n^2) */
spin_lock(&obd->obd_recovery_task_lock);
- LASSERT(obd->obd_recovering);
+ LASSERT(test_bit(OBDF_RECOVERING, obd->obd_flags));
list_for_each_entry(reqiter, &obd->obd_req_replay_queue, rq_list) {
if (lustre_msg_get_transno(reqiter->rq_reqmsg) > transno) {
list_add_tail(&req->rq_list, &reqiter->rq_list);
* request replay stage.
*/
obd = ldlm_res_to_ns(res)->ns_obd;
- if (obd->obd_recovering &&
+ if (test_bit(OBDF_RECOVERING, obd->obd_flags) &&
atomic_read(&obd->obd_req_replay_clients) == 0)
RETURN_EXIT;
restart:
LASSERT(data != NULL);
obd = lock->l_export->exp_obd;
- if (obd->obd_recovering != 0)
+ if (test_bit(OBDF_RECOVERING, obd->obd_flags))
LDLM_ERROR(lock, "BUG 6063: lock collide during recovery");
ldlm_lock_reorder_req(lock);
top_dev = exp->exp_obd->obd_lu_dev->ld_site->ls_top_dev;
if (top_dev != NULL &&
- top_dev->ld_obd->obd_recovering)
+ test_bit(OBDF_RECOVERING, top_dev->ld_obd->obd_flags))
req->rq_allow_replay = 1;
}
obd->obd_no_conn = 0;
spin_unlock(&obd->obd_dev_lock);
- if (obd->obd_recovering == 0)
+ if (!test_bit(OBDF_RECOVERING, obd->obd_flags))
mdt_postrecov(env, mdt);
RETURN(rc);
RETURN(-EINVAL);
/* NOT allow barrier operations during recovery. */
- if (unlikely(mgs->mgs_obd->obd_recovering))
+ if (unlikely(test_bit(OBDF_RECOVERING, mgs->mgs_obd->obd_flags)))
RETURN(-EBUSY);
switch (bc->bc_cmd) {
struct obd_device *obd = exp->exp_obd;
spin_lock(&obd->obd_recovery_task_lock);
- if (obd->obd_recovering) {
+ if (test_bit(OBDF_RECOVERING, obd->obd_flags)) {
if (exp->exp_in_recovery) {
spin_lock(&exp->exp_lock);
exp->exp_in_recovery = 0;
struct obd_export *exp, *n;
int connected;
- if (!obd->obd_recovering ||
+ if (!test_bit(OBDF_RECOVERING, obd->obd_flags) ||
atomic_read(&obd->obd_connected_clients) >=
atomic_read(&obd->obd_max_recoverable_clients))
/* not in recovery */
}
/* There is gap between client data read from storage and setting
- * obd_recovering so check obd_recovery_end as well to make sure
+ * OBDF_RECOVERING so check obd_recovery_end as well to make sure
* recovery is really finished
*/
- if (obd->obd_recovery_end > 0 && !obd->obd_recovering) {
+ if (obd->obd_recovery_end > 0 && !test_bit(OBDF_RECOVERING, obd->obd_flags)) {
seq_printf(m, "COMPLETE\n");
seq_printf(m, "recovery_start: %lld\n",
(s64)ktime_get_real_seconds() -
obd->obd_no_conn = 0;
spin_unlock(&obd->obd_dev_lock);
- if (obd->obd_recovering == 0)
+ if (!test_bit(OBDF_RECOVERING, obd->obd_flags))
ofd_postrecov(env, ofd);
RETURN(rc);
if ((oa->o_valid & OBD_MD_FLFLAGS) &&
(oa->o_flags & OBD_FL_RECREATE_OBJS)) {
- if (!ofd_obd(ofd)->obd_recovering ||
+ if (!test_bit(OBDF_RECOVERING, ofd_obd(ofd)->obd_flags) ||
oid > ofd_seq_last_oid(oseq)) {
CERROR("%s: recreate objid "DOSTID" > last id %llu"
"\n", ofd_name(ofd), POSTID(&oa->o_oi),
LASSERT(env != NULL);
LASSERT(objcount == 1);
- if (unlikely(exp->exp_obd->obd_recovering)) {
+ if (unlikely(test_bit(OBDF_RECOVERING, exp->exp_obd->obd_flags))) {
u64 seq = ostid_seq(&oa->o_oi);
u64 oid = ostid_id(&oa->o_oi);
struct ofd_seq *oseq;
* 1. sent during recovery, or
* 2. sent before the recovery thread target_recovery_thread() start,
* such as triggered by lod_sub_recovery_thread(). */
- if (obd->obd_recovering || (obd->obd_replayable && obd->obd_no_conn))
+ if (test_bit(OBDF_RECOVERING, obd->obd_flags) ||
+ (obd->obd_replayable && obd->obd_no_conn))
req->rq_allow_replay = 1;
}
/* there is no recovery for OST OBD, all recovery is controlled by
* obdfilter OBD
*/
- LASSERT(obd->obd_recovering == 0);
+ LASSERT(!test_bit(OBDF_RECOVERING, obd->obd_flags));
mutex_lock(&ost->ost_health_mutex);
ptlrpc_unregister_service(ost->ost_service);
ptlrpc_unregister_service(ost->ost_create_service);
* b=15815
*/
if (req->rq_type == PTL_RPC_MSG_ERR &&
- (req->rq_export == NULL || obd->obd_recovering)) {
+ (req->rq_export == NULL || test_bit(OBDF_RECOVERING, obd->obd_flags))) {
lustre_msg_set_timeout(req->rq_repmsg, 0);
} else {
timeout_t timeout;
struct obd_type *type = exp->exp_obd->obd_type;
if (strcmp(type->typ_name, LUSTRE_MDT_NAME) != 0)
return;
- if (exp->exp_obd->obd_recovering)
+ if (test_bit(OBDF_RECOVERING, exp->exp_obd->obd_flags))
return;
ldlm_revoke_export_locks(exp);
list_move_tail(&exp->exp_obd_chain_timed,
&exp->exp_obd->obd_exports_timed);
- if (exp->exp_obd->obd_recovering) {
+ if (test_bit(OBDF_RECOVERING, exp->exp_obd->obd_flags)) {
/* be nice to everyone during recovery */
spin_unlock(&exp->exp_obd->obd_dev_lock);
RETURN_EXIT;
rc = -ENODEV;
} else if (lustre_msg_get_flags(req->rq_reqmsg) &
(MSG_REPLAY | MSG_REQ_REPLAY_DONE) &&
- !obd->obd_recovering) {
+ !test_bit(OBDF_RECOVERING, obd->obd_flags)) {
DEBUG_REQ(D_ERROR, req,
"Invalid replay without recovery");
class_fail_export(req->rq_export);
rc = -ENODEV;
} else if (lustre_msg_get_transno(req->rq_reqmsg) != 0 &&
- !obd->obd_recovering) {
+ !test_bit(OBDF_RECOVERING, obd->obd_flags)) {
DEBUG_REQ(D_ERROR, req,
"Invalid req with transno %llu without recovery",
lustre_msg_get_transno(req->rq_reqmsg));
req_waited = right_now - request->rq_arrival_time.tv_sec;
svc_waited = right_now - svcpt->scp_last_request;
- recovering = obd ? obd->obd_recovering : false;
+ recovering = obd ? test_bit(OBDF_RECOVERING, obd->obd_flags) : false;
spin_unlock(&svcpt->scp_req_lock);
max = obd_get_at_max(obd);
assert_spin_locked(&tgd->tgd_grant_lock);
- if (obd->obd_recovering) {
+ if (test_bit(OBDF_RECOVERING, obd->obd_flags)) {
/* Replaying write. Grant info have been processed already so no
* need to do any enforcement here. It is worth noting that only
* bulk writes with all rnbs having OBD_BRW_FROM_GRANT can be
ted->ted_grant, i);
}
- if (obd->obd_recovering)
+ if (test_bit(OBDF_RECOVERING, obd->obd_flags))
CERROR("%s: cli %s is replaying OST_WRITE while one rnb"
" hasn't OBD_BRW_FROM_GRANT set (0x%x)\n",
obd->obd_name, exp->exp_client_uuid.uuid,
"\n", obd->obd_name, exp->exp_client_uuid.uuid, exp,
granted, ungranted, ted->ted_grant, ted->ted_dirty);
- if (obd->obd_recovering || (oa->o_valid & OBD_MD_FLGRANT) == 0)
+ if (test_bit(OBDF_RECOVERING, obd->obd_flags) ||
+ (oa->o_valid & OBD_MD_FLGRANT) == 0)
/* don't update dirty accounting during recovery or
* if grant information got discarded (e.g. during resend) */
RETURN_EXIT;
if (curgrant >= want || curgrant >= ted->ted_grant + chunk)
RETURN(0);
- if (obd->obd_recovering)
+ if (test_bit(OBDF_RECOVERING, obd->obd_flags))
conservative = false;
if (conservative)
/* When close to free space exhaustion, trigger a sync to force
* writeback cache to consume required space immediately and release as
* much space as possible. */
- if (!obd->obd_recovering && force != 2 && left < chunk) {
+ if (!test_bit(OBDF_RECOVERING, obd->obd_flags) && force != 2 && left < chunk) {
bool from_grant = true;
int i;
unsigned long granted;
ENTRY;
- if (exp->exp_obd->obd_recovering ||
+ if (test_bit(OBDF_RECOVERING, exp->exp_obd->obd_flags) ||
lut->lut_dt_conf.ddp_inodespace == 0)
/* don't enforce grant during recovery */
RETURN(0);
* open. */
/* Check for aborted recovery... */
- if (unlikely(req->rq_export->exp_obd->obd_recovering)) {
+ if (unlikely(test_bit(OBDF_RECOVERING, req->rq_export->exp_obd->obd_flags))) {
int rc;
int should_process;
LASSERT(mode == LCK_PR || mode == LCK_PW);
LASSERT(!lustre_handle_is_used(lh));
- if (exp->exp_obd->obd_recovering)
+ if (test_bit(OBDF_RECOVERING, exp->exp_obd->obd_flags))
RETURN(0);
if (nrbufs == 0 || !(nb[0].rnb_flags & OBD_BRW_SRVLOCK))
ENTRY;
LASSERT(mode == LCK_PR || mode == LCK_PW);
- LASSERT((!exp->exp_obd->obd_recovering && obj->ioo_bufcnt &&
+ LASSERT((!test_bit(OBDF_RECOVERING, exp->exp_obd->obd_flags) && obj->ioo_bufcnt &&
niob[0].rnb_flags & OBD_BRW_SRVLOCK) ==
lustre_handle_is_used(lh));
if (tmt->tmt_batchid <= tdtd->tdtd_committed_batchid) {
__set_current_state(TASK_RUNNING);
list_move_tail(&tmt->tmt_commit_list, &list);
- } else if (!tdtd->tdtd_lut->lut_obd->obd_recovering) {
+ } else if (!test_bit(OBDF_RECOVERING, tdtd->tdtd_lut->lut_obd->obd_flags)) {
__set_current_state(TASK_RUNNING);
LASSERTF(tmt->tmt_batchid >= batchid,
"tmt %px tmt_batchid: %llu, batchid %llu\n",