From 9c596a4996ee242aa1b954f5f2f19101d3941bf0 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Sun, 19 Nov 2017 13:55:11 +0800 Subject: [PATCH] LU-10237 mdc: interruptable during RPC retry for EINPROGRESS 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. Signed-off-by: Fan Yong Change-Id: I4f939f9a350d3a99ce3d3af37d0dea8ab8030fee Reviewed-on: https://review.whamcloud.com/30166 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin --- lustre/mdc/mdc_locks.c | 30 ++++++++++++++++-------------- lustre/mdc/mdc_reint.c | 24 +++++++++++++----------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index b65b958..546b7f5 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -885,21 +885,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) { diff --git a/lustre/mdc/mdc_reint.c b/lustre/mdc/mdc_reint.c index 73572b4..a339a94 100644 --- a/lustre/mdc/mdc_reint.c +++ b/lustre/mdc/mdc_reint.c @@ -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); -- 1.8.3.1