Whamcloud - gitweb
LU-10237 mdc: interruptable during RPC retry for EINPROGRESS 03/30903/2
authorFan Yong <fan.yong@intel.com>
Sun, 19 Nov 2017 05:55:11 +0000 (13:55 +0800)
committerJohn L. Hammond <john.hammond@intel.com>
Fri, 9 Feb 2018 18:12:42 +0000 (18:12 +0000)
Sometimes, some system resource may be inaccessible temporarily,
for example, related OI mapping is crashed and has yet not been
rebuilt. Under such case, the server will reply the client with
"-EINPROGRESS", then client will retry the RPC some time later.

Currently, the client will retry infinitely until related RPC
succeed or get other failure. But we do not know how long it
will be before related resource becoming available. It may be
very long time as to the RPC sponsor - the application or the
user does not want to retry any more, then we need to make the
logic to be interruptable. This patch is for such purpose.

Lustre-change: https://review.whamcloud.com/30166
Lustre-commit: 9c596a4996ee242aa1b954f5f2f19101d3941bf0

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I4f939f9a350d3a99ce3d3af37d0dea8ab8030fee
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Signed-off-by: Minh Diep <minh.diep@intel.com>
Reviewed-on: https://review.whamcloud.com/30903
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
lustre/mdc/mdc_locks.c
lustre/mdc/mdc_reint.c

index e007fc3..1fadf79 100644 (file)
@@ -860,21 +860,23 @@ resend:
         * intent operation, when server returns -EINPROGRESS for acquiring
         * intent lock, we'll retry in after_reply(). */
        if (it && (int)lockrep->lock_policy_res2 == -EINPROGRESS) {
-                mdc_clear_replay_flag(req, rc);
-                ptlrpc_req_finished(req);
-                resends++;
-
-                CDEBUG(D_HA, "%s: resend:%d op:%d "DFID"/"DFID"\n",
-                       obddev->obd_name, resends, it->it_op,
-                       PFID(&op_data->op_fid1), PFID(&op_data->op_fid2));
-
-                if (generation == obddev->u.cli.cl_import->imp_generation) {
-                        goto resend;
-                } else {
+               mdc_clear_replay_flag(req, rc);
+               ptlrpc_req_finished(req);
+               if (generation == obddev->u.cli.cl_import->imp_generation) {
+                       if (signal_pending(current))
+                               RETURN(-EINTR);
+
+                       resends++;
+                       CDEBUG(D_HA, "%s: resend:%d op:%d "DFID"/"DFID"\n",
+                              obddev->obd_name, resends, it->it_op,
+                              PFID(&op_data->op_fid1),
+                              PFID(&op_data->op_fid2));
+                       goto resend;
+               } else {
                        CDEBUG(D_HA, "resend cross eviction\n");
-                        RETURN(-EIO);
-                }
-        }
+                       RETURN(-EIO);
+               }
+       }
 
        rc = mdc_finish_enqueue(exp, req, einfo, it, lockh, rc);
        if (rc < 0) {
index fb59428..75ed568 100644 (file)
@@ -234,17 +234,19 @@ rebuild:
                 level = LUSTRE_IMP_RECOVER;
                 goto resend;
         } else if (rc == -EINPROGRESS) {
-                /* Retry create infinitely until succeed or get other
-                 * error code. */
-                ptlrpc_req_finished(req);
-                resends++;
-
-                CDEBUG(D_HA, "%s: resend:%d create on "DFID"/"DFID"\n",
-                       exp->exp_obd->obd_name, resends,
-                       PFID(&op_data->op_fid1), PFID(&op_data->op_fid2));
-
-                if (generation == import->imp_generation) {
-                        goto rebuild;
+               /* Retry create infinitely until succeed or get other
+                * error code or interrupted. */
+               ptlrpc_req_finished(req);
+               if (generation == import->imp_generation) {
+                       if (signal_pending(current))
+                               RETURN(-EINTR);
+
+                       resends++;
+                       CDEBUG(D_HA, "%s: resend:%d create on "DFID"/"DFID"\n",
+                              exp->exp_obd->obd_name, resends,
+                              PFID(&op_data->op_fid1),
+                              PFID(&op_data->op_fid2));
+                       goto rebuild;
                 } else {
                         CDEBUG(D_HA, "resend cross eviction\n");
                         RETURN(-EIO);