From ec654e2bd120d1aeec5993b81a11fa66cf7ea20f Mon Sep 17 00:00:00 2001 From: wangdi Date: Fri, 4 Oct 2013 04:47:25 -0700 Subject: [PATCH] LU-1445 fld: allow fld lookup during recovery Allow fld lookup during recovery process, so OST can send fld lookup req to MDT0 during recovery phase, instead of waiting the recovery is done. Signed-off-by: wang di Change-Id: I69990eb4225d98f20ce2dc197cd3c16b5c6f9617 Reviewed-on: http://review.whamcloud.com/4919 Reviewed-by: Mike Pershin Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Alex Zhuravlev --- lustre/fld/fld_request.c | 22 ++++++++++++++-------- lustre/include/lustre_net.h | 5 ++++- lustre/ptlrpc/client.c | 16 +++++++++++----- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index 1aec284..1b43b3d 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -418,16 +418,18 @@ EXPORT_SYMBOL(fld_client_fini); int fld_client_rpc(struct obd_export *exp, struct lu_seq_range *range, __u32 fld_op) { - struct ptlrpc_request *req; - struct lu_seq_range *prange; - __u32 *op; - int rc; - ENTRY; + struct ptlrpc_request *req; + struct lu_seq_range *prange; + __u32 *op; + int rc; + struct obd_import *imp; + ENTRY; - LASSERT(exp != NULL); + LASSERT(exp != NULL); - req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_FLD_QUERY, - LUSTRE_MDS_VERSION, FLD_QUERY); + imp = class_exp2cliimp(exp); + req = ptlrpc_request_alloc_pack(imp, &RQF_FLD_QUERY, LUSTRE_MDS_VERSION, + FLD_QUERY); if (req == NULL) RETURN(-ENOMEM); @@ -441,6 +443,10 @@ int fld_client_rpc(struct obd_export *exp, req->rq_request_portal = FLD_REQUEST_PORTAL; ptlrpc_at_set_req_timeout(req); + if (fld_op == FLD_LOOKUP && + imp->imp_connect_flags_orig & OBD_CONNECT_MDS_MDS) + req->rq_allow_replay = 1; + if (fld_op != FLD_LOOKUP) mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL); fld_enter_request(&exp->exp_obd->u.cli); diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index e0330dc..b1e0682 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -719,7 +719,10 @@ struct ptlrpc_request { rq_invalid_rqset:1, rq_generation_set:1, /* do not resend request on -EINPROGRESS */ - rq_no_retry_einprogress:1; + rq_no_retry_einprogress:1, + /* allow the req to be sent if the import is in recovery + * status */ + rq_allow_replay:1; unsigned int rq_nr_resend; diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 3d4d73a..54208b8 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -1063,12 +1063,18 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, *status = -EIO; } else if (imp->imp_dlm_fake || req->rq_no_delay) { *status = -EWOULDBLOCK; - } else { - delay = 1; - } - } + } else if (req->rq_allow_replay && + (imp->imp_state == LUSTRE_IMP_REPLAY || + imp->imp_state == LUSTRE_IMP_REPLAY_LOCKS || + imp->imp_state == LUSTRE_IMP_REPLAY_WAIT || + imp->imp_state == LUSTRE_IMP_RECOVER)) { + DEBUG_REQ(D_HA, req, "allow during recovery.\n"); + } else { + delay = 1; + } + } - RETURN(delay); + RETURN(delay); } /** -- 1.8.3.1