From 8d2dab899a98d03a4ae3bdf3b73a3827990aa2ad Mon Sep 17 00:00:00 2001 From: Alexander Boyko Date: Thu, 10 Nov 2016 12:30:41 -0500 Subject: [PATCH] staging: lustre: ptlrpc: race at req processing Fix: 5c689e689baa ("staging/lustre/ptlrpc: race at req processing") decreased the race window, but does not remove it. Disable rq_resend right after MSG_REPLAY flag set. Import lock protects two threads from race between set/clear MSG_REPLAY and rq_resend flags. Signed-off-by: Alexander Boyko Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5554 Xyratex-bug-id: MRP-1888 Reviewed-on: http://review.whamcloud.com/10735 Reviewed-by: Niu Yawei Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index bb7ae4e08902..afdc0df60154 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -2714,6 +2714,10 @@ void ptlrpc_retain_replayable_request(struct ptlrpc_request *req, lustre_msg_add_flags(req->rq_reqmsg, MSG_REPLAY); + spin_lock(&req->rq_lock); + req->rq_resend = 0; + spin_unlock(&req->rq_lock); + LASSERT(imp->imp_replayable); /* Balanced in ptlrpc_free_committed, usually. */ ptlrpc_request_addref(req); -- 2.20.1