From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965543AbcKJRtT (ORCPT ); Thu, 10 Nov 2016 12:49:19 -0500 Received: from smtp2.ccs.ornl.gov ([160.91.203.11]:48746 "EHLO smtp2.ccs.ornl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965028AbcKJRb3 (ORCPT ); Thu, 10 Nov 2016 12:31:29 -0500 From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin Cc: Linux Kernel Mailing List , Lustre Development List , Alexander Boyko , James Simmons Subject: [PATCH 11/35] staging: lustre: ptlrpc: race at req processing Date: Thu, 10 Nov 2016 12:30:41 -0500 Message-Id: <1478799065-24841-12-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1478799065-24841-1-git-send-email-jsimmons@infradead.org> References: <1478799065-24841-1-git-send-email-jsimmons@infradead.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Boyko 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 --- drivers/staging/lustre/lustre/ptlrpc/client.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index b940e24..d2f4cd5 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -2690,6 +2690,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); -- 1.7.1