From 95014d930c3af872d31596b0bc0c2d7ad82ce920 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 18 Sep 2024 23:45:24 -0400 Subject: [PATCH] LU-18231 obd: change obd_recovering into OBDF_RECOVERING Change the use of the odb_recovering bitfield into a bit in the ofd_flags bitmap and use atomic bit set/clear/test operations on it. No logical changes to the code and no changes to locking. Test-Parameters: trivial Signed-off-by: Ronnie Sahlberg Change-Id: I031da297c4c6d0325851ddeac0768ea21d88e25f Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56415 Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Reviewed-by: Timothy Day Tested-by: jenkins Tested-by: Maloo --- lustre/include/obd.h | 2 +- lustre/ldlm/ldlm_lib.c | 43 ++++++++++++++++++--------------- lustre/ldlm/ldlm_lock.c | 2 +- lustre/ldlm/ldlm_lockd.c | 2 +- lustre/ldlm/ldlm_request.c | 2 +- lustre/mdt/mdt_handler.c | 2 +- lustre/mgs/mgs_barrier.c | 2 +- lustre/obdclass/genops.c | 2 +- lustre/obdclass/lprocfs_status_server.c | 6 ++--- lustre/ofd/ofd_dev.c | 4 +-- lustre/ofd/ofd_io.c | 2 +- lustre/osp/osp_internal.h | 3 ++- lustre/ost/ost_handler.c | 2 +- lustre/ptlrpc/niobuf.c | 2 +- lustre/ptlrpc/nodemap_member.c | 2 +- lustre/ptlrpc/service.c | 8 +++--- lustre/target/tgt_grant.c | 13 +++++----- lustre/target/tgt_handler.c | 6 ++--- lustre/target/update_trans.c | 2 +- 19 files changed, 56 insertions(+), 51 deletions(-) diff --git a/lustre/include/obd.h b/lustre/include/obd.h index d82d3d1..569d809 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -597,6 +597,7 @@ struct obd_llog_group { enum { OBDF_ATTACHED, /* finished attach */ OBDF_SET_UP, /* finished setup */ + OBDF_RECOVERING, /* there are recoverable clients */ OBDF_NUM_FLAGS, }; @@ -616,7 +617,6 @@ struct obd_device { /* 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 */ diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index d2f67c0..32e28ee 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -810,7 +810,8 @@ static inline int target_check_recovery_timer(struct obd_device *target) 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); @@ -823,7 +824,7 @@ static inline int target_check_recovery_timer(struct obd_device *target) * 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); @@ -875,7 +876,7 @@ static int target_handle_reconnect(struct lustre_handle *conn, 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)); @@ -1337,7 +1338,7 @@ no_export: 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); @@ -1345,7 +1346,7 @@ no_export: * 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); /* @@ -1369,7 +1370,8 @@ no_export: * 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; @@ -1526,7 +1528,8 @@ dont_check_exports: 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; @@ -1578,7 +1581,7 @@ dont_check_exports: } /* 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: @@ -1839,12 +1842,12 @@ void target_cleanup_recovery(struct obd_device *obd) 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); @@ -1889,7 +1892,7 @@ static void target_start_recovery_timer(struct obd_device *obd) 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; } @@ -1933,7 +1936,7 @@ static void extend_recovery_timer(struct obd_device *obd, timeout_t dr_timeout, 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; @@ -2208,7 +2211,7 @@ static int target_recovery_overseer(struct lu_target *lut, 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", @@ -2755,7 +2758,7 @@ static int target_recovery_thread(void *arg) 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); @@ -2824,7 +2827,7 @@ static int target_recovery_thread(void *arg) * 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); @@ -2882,7 +2885,7 @@ static int target_start_recovery_thread(struct lu_target *lut, 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; } @@ -2896,7 +2899,7 @@ void target_stop_recovery_thread(struct obd_device *obd) 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); @@ -3036,7 +3039,7 @@ int target_queue_recovery_request(struct ptlrpc_request *req, 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; @@ -3086,7 +3089,7 @@ int target_queue_recovery_request(struct ptlrpc_request *req, 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); @@ -3159,7 +3162,7 @@ int target_queue_recovery_request(struct ptlrpc_request *req, /* 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); diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index ee6c07d..63ebd47 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -2376,7 +2376,7 @@ static void __ldlm_reprocess_all(struct ldlm_resource *res, * 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: diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 7ad00c2..32d9f89 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -943,7 +943,7 @@ int ldlm_server_blocking_ast(struct ldlm_lock *lock, 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); diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index a62f4b5..e7ac552 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -1437,7 +1437,7 @@ int ldlm_cli_cancel_req(struct obd_export *exp, struct ldlm_lock *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; } diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 07865bd..75a3d88 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -6911,7 +6911,7 @@ static int mdt_prepare(const struct lu_env *env, 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); diff --git a/lustre/mgs/mgs_barrier.c b/lustre/mgs/mgs_barrier.c index d23eff3..1e56576 100644 --- a/lustre/mgs/mgs_barrier.c +++ b/lustre/mgs/mgs_barrier.c @@ -765,7 +765,7 @@ int mgs_iocontrol_barrier(const struct lu_env *env, 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) { diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 702e258..fffa1ec 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -1321,7 +1321,7 @@ static void class_export_recovery_cleanup(struct obd_export *exp) 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; diff --git a/lustre/obdclass/lprocfs_status_server.c b/lustre/obdclass/lprocfs_status_server.c index 6cb68dc..d452e99 100644 --- a/lustre/obdclass/lprocfs_status_server.c +++ b/lustre/obdclass/lprocfs_status_server.c @@ -85,7 +85,7 @@ int lprocfs_recovery_stale_clients_seq_show(struct seq_file *m, void *data) 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 */ @@ -912,10 +912,10 @@ int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data) } /* 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() - diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 2ab4ead..2cdbbba 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -653,7 +653,7 @@ static int ofd_prepare(const struct lu_env *env, struct lu_device *pdev, 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); @@ -1503,7 +1503,7 @@ static int ofd_create_hdl(struct tgt_session_info *tsi) 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), diff --git a/lustre/ofd/ofd_io.c b/lustre/ofd/ofd_io.c index 54cfe02..197b18d 100644 --- a/lustre/ofd/ofd_io.c +++ b/lustre/ofd/ofd_io.c @@ -716,7 +716,7 @@ static int ofd_preprw_write(const struct lu_env *env, struct obd_export *exp, 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; diff --git a/lustre/osp/osp_internal.h b/lustre/osp/osp_internal.h index 20b03a3..99022fc 100644 --- a/lustre/osp/osp_internal.h +++ b/lustre/osp/osp_internal.h @@ -853,7 +853,8 @@ static inline void osp_set_req_replay(const struct osp_device *osp, * 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; } diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 80fa454..530d45a 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -371,7 +371,7 @@ static int ost_cleanup(struct obd_device *obd) /* 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); diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index 1d267ea..13f57e9 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -547,7 +547,7 @@ static void ptlrpc_at_set_reply(struct ptlrpc_request *req, int flags) * 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; diff --git a/lustre/ptlrpc/nodemap_member.c b/lustre/ptlrpc/nodemap_member.c index 2227e66..d0a112a 100644 --- a/lustre/ptlrpc/nodemap_member.c +++ b/lustre/ptlrpc/nodemap_member.c @@ -146,7 +146,7 @@ static void nm_member_exp_revoke(struct obd_export *exp) 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); diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 3818c80..f5c7d58 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -1149,7 +1149,7 @@ void ptlrpc_update_export_timer(struct obd_export *exp, time64_t extra_delay) 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; @@ -1232,13 +1232,13 @@ static int ptlrpc_check_req(struct ptlrpc_request *req) 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)); @@ -3717,7 +3717,7 @@ static int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt) 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); diff --git a/lustre/target/tgt_grant.c b/lustre/target/tgt_grant.c index 23f9457..16e7762 100644 --- a/lustre/target/tgt_grant.c +++ b/lustre/target/tgt_grant.c @@ -711,7 +711,7 @@ static void tgt_grant_check(const struct lu_env *env, struct obd_export *exp, 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 @@ -785,7 +785,7 @@ static void tgt_grant_check(const struct lu_env *env, struct obd_export *exp, 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, @@ -836,7 +836,8 @@ static void tgt_grant_check(const struct lu_env *env, struct obd_export *exp, "\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; @@ -922,7 +923,7 @@ static long tgt_grant_alloc(struct obd_export *exp, u64 curgrant, 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) @@ -1256,7 +1257,7 @@ refresh: /* 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; @@ -1335,7 +1336,7 @@ long tgt_grant_create(const struct lu_env *env, struct obd_export *exp, s64 *nr) 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); diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index bc52201..c8f24db 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -572,7 +572,7 @@ static int tgt_handle_recovery(struct ptlrpc_request *req, int reply_fail_id) * 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; @@ -1787,7 +1787,7 @@ static int tgt_brw_lock(const struct lu_env *env, struct obd_export *exp, 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)) @@ -1809,7 +1809,7 @@ static void tgt_brw_unlock(struct obd_export *exp, struct obd_ioobj *obj, 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)); diff --git a/lustre/target/update_trans.c b/lustre/target/update_trans.c index a3621c3..449be98 100644 --- a/lustre/target/update_trans.c +++ b/lustre/target/update_trans.c @@ -1533,7 +1533,7 @@ static int distribute_txn_commit_thread(void *_arg) 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", -- 1.8.3.1