Whamcloud - gitweb
LU-1445 fld: allow fld lookup during recovery
authorwangdi <di.wang@whamcloud.com>
Fri, 4 Oct 2013 11:47:25 +0000 (04:47 -0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 28 Jan 2013 06:12:56 +0000 (01:12 -0500)
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 <di.wang@intel.com>
Change-Id: I69990eb4225d98f20ce2dc197cd3c16b5c6f9617
Reviewed-on: http://review.whamcloud.com/4919
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
lustre/fld/fld_request.c
lustre/include/lustre_net.h
lustre/ptlrpc/client.c

index 1aec284..1b43b3d 100644 (file)
@@ -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);
index e0330dc..b1e0682 100644 (file)
@@ -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;
 
index 3d4d73a..54208b8 100644 (file)
@@ -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);
 }
 
 /**