From patchwork Tue Nov 21 16:40:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13463373 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 361E048CD2; Tue, 21 Nov 2023 16:40:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L9ks28JN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40347C433C9; Tue, 21 Nov 2023 16:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700584847; bh=sY0QBw/CFVc90IX3+9inmZeJI9yFyDQM40EBsVYTdLQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=L9ks28JNYLMfIBdKEzRYSWrv6gzfryB1JO9su922nrT2632MdjpUNeBpY50cvfpvg R3vUD/Y7rIhIuYMjHWgFGPjjqUXPSgoSEQK3i4E75R5IBUM2cRCijauaIHoPhAZkWp yHg53P2qv/aUPPB0N9nxE+eN5rzz6bTWh9ALwNv0BT+Nfp0PQpvHNNwpatNZGe7BW8 zNhBZIJmy8s+Xv+7BST3Rhpl741p/KJVQQv86YaOc3s/XLKCNN01vX9XXYKy3dyuNw WUuIlEzYs/G+Q4w69mQhFywNP06/8BReHA0bNimDqyhekdBpuv9N+RtEZmLP3qyPaI lpo65Hfvl9tBg== Subject: [PATCH v2 6/6] svcrdma: Clean up locking From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Cc: Chuck Lever , tom@talpey.com Date: Tue, 21 Nov 2023 11:40:46 -0500 Message-ID: <170058484626.4504.11730967527703634448.stgit@bazille.1015granger.net> In-Reply-To: <170058462629.4504.17663192195815644972.stgit@bazille.1015granger.net> References: <170058462629.4504.17663192195815644972.stgit@bazille.1015granger.net> User-Agent: StGit/1.5 Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever There's no need to protect llist_entry() with a spin lock. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/svc_rdma_sendto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c index 22c39ba923d2..09f5d0570bc9 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c @@ -201,10 +201,11 @@ struct svc_rdma_send_ctxt *svc_rdma_send_ctxt_get(struct svcxprt_rdma *rdma) spin_lock(&rdma->sc_send_lock); node = llist_del_first(&rdma->sc_send_ctxts); + spin_unlock(&rdma->sc_send_lock); if (!node) goto out_empty; + ctxt = llist_entry(node, struct svc_rdma_send_ctxt, sc_node); - spin_unlock(&rdma->sc_send_lock); out: rpcrdma_set_xdrlen(&ctxt->sc_hdrbuf, 0); @@ -217,7 +218,6 @@ struct svc_rdma_send_ctxt *svc_rdma_send_ctxt_get(struct svcxprt_rdma *rdma) return ctxt; out_empty: - spin_unlock(&rdma->sc_send_lock); ctxt = svc_rdma_send_ctxt_alloc(rdma); if (!ctxt) return NULL;