Whamcloud - gitweb
LU-13600 ptlrpc: re-enterable signal_completed_replay() 40/39140/4
authorMikhail Pershin <mpershin@whamcloud.com>
Mon, 22 Jun 2020 18:04:34 +0000 (21:04 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 3 Jul 2020 15:01:25 +0000 (15:01 +0000)
The signal_completed_replay() can meet race conditions while
checking imp_replay_inflight counter, so remove assertion and
check race conditions instead.

Fixes: 3b613a442b ("LU-13600 ptlrpc: limit rate of lock replays")
Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: Ib7c372b1757556b7285f380b40167742f9b71ec6
Reviewed-on: https://review.whamcloud.com/39140
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ptlrpc/import.c

index 4849364..6221bbc 100644 (file)
@@ -1455,8 +1455,8 @@ static int signal_completed_replay(struct obd_import *imp)
        if (unlikely(OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_FINISH_REPLAY)))
                RETURN(0);
 
-       LASSERT(atomic_read(&imp->imp_replay_inflight) == 0);
-       atomic_inc(&imp->imp_replay_inflight);
+       if (!atomic_add_unless(&imp->imp_replay_inflight, 1, 1))
+               RETURN(0);
 
        req = ptlrpc_request_alloc_pack(imp, &RQF_OBD_PING, LUSTRE_OBD_VERSION,
                                        OBD_PING);