From mboxrd@z Thu Jan 1 00:00:00 1970 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 346CB15D5B7; Mon, 18 Nov 2024 21:20:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964845; cv=none; b=DmZlgNTH/NTZWv+XwUL7lF3wtxxDGTjZWATLKaFLtbS70s8au81WvvsI4klmLTr175pN4ma7yNiclcTTIj1x8jRZQL90lruLVlMHOnmJQ/DOw6XtOx68zKQ0KBBeEWCKHCznOKGRRLm9thxz5kbkC2fXiwWo3Onpvt6CidW77zU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964845; c=relaxed/simple; bh=MmNZW2BO6/hZLJY2y2H8eprKc3nS4nEdDPVPe3ok95Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NN/dZGiTLMf0ZSQWIif0gi3hq8jC9tAZGyMxo5t5dZLC/HGm/igOQNysHXpJqHX3qD8tj6oniwx4B5rxYveBWvefsdNOXg7MaShKcpck+6sziSTZ19LZxfVrJ7npjNujXNvG0z50H065W0oC/kCqiku1Ak+fzjtAf0c7M+XT3LU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PwT75Wc0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PwT75Wc0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38B30C4CEDB; Mon, 18 Nov 2024 21:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964844; bh=MmNZW2BO6/hZLJY2y2H8eprKc3nS4nEdDPVPe3ok95Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PwT75Wc0HGYh2fTs/ykDG05ui1mSvLVFNqIypM62kMRZfmqSLlaEufSN78kTSOGSX VhHx2R6oO3+mWNtdQL1d7ck0NfG7P/EIzcXwAZuV2/dGbm05iGtwbhLU8zuccx3Ct5 KfiC6D1eINYJbLy9CosHKqDncDbEpuc9ZyhRSycsYo9Ulz84C7aTX/4HId0EkKtmNE TZyEg2VXSku3tG4JNBVRJjFUlwmJzpo+6eKHGKkfOMp3OmpLDmoqGYD55FHQeIPp1r R/Anu4oEWv66Qj9StCqvGX2UVP/lPKdCpGevBReOWVIFbMcdwqDOvF+pllds9MPnPR pUbKdnqJ+YiQg== From: cel@kernel.org To: Cc: , Jeff Layton , Chuck Lever , Olga Kornievskaia Subject: [PATCH 5.15 5/5] NFSD: Never decrement pending_async_copies on error Date: Mon, 18 Nov 2024 16:20:21 -0500 Message-ID: <20241118212035.3848-10-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Chuck Lever [ Upstream commit 8286f8b622990194207df9ab852e0f87c60d35e9 ] The error flow in nfsd4_copy() calls cleanup_async_copy(), which already decrements nn->pending_async_copies. Reported-by: Olga Kornievskaia Fixes: aadc3bbea163 ("NFSD: Limit the number of concurrent async COPY operations") Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 6267a41092ae..0b698e25826f 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1791,10 +1791,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, refcount_set(&async_copy->refcount, 1); /* Arbitrary cap on number of pending async copy operations */ if (atomic_inc_return(&nn->pending_async_copies) > - (int)rqstp->rq_pool->sp_nrthreads) { - atomic_dec(&nn->pending_async_copies); + (int)rqstp->rq_pool->sp_nrthreads) goto out_err; - } async_copy->cp_src = kmalloc(sizeof(*async_copy->cp_src), GFP_KERNEL); if (!async_copy->cp_src) goto out_err; -- 2.47.0 From mboxrd@z Thu Jan 1 00:00:00 1970 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 4201D1BDABE for ; Tue, 19 Nov 2024 12:31:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732019496; cv=none; b=MFdALYYqSImlYbHQ05ICknbXy3PCo1lrXiYAk1aRPFszhAxh3SyOAJgN+bTM/PijjQgDqmHrTvtBvJrEPp79H9I/FufZ/qx+ilVusX3m51DomCkZ37Buk/Qlgb+Y8gPhNEjWDHnOQ6nJ4OqU6eIHUL8ByKFOZqNUYGeFJ0b35u8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732019496; c=relaxed/simple; bh=/Nld003I2yXGwv3RvPd4oUqhz91Qdlmk7WaiDxVoiXQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=loYmjJTFLIm7NQ62TaAgtXYXwydp0KsJGDpUHKjn4qgUmrwLrXQMrKVzGB8ZCvINZOz2nYf6o7vj5/I1VyI5BmSFWTVco7TUab3ZP0RjTUWKy770zWZhaUr1cLCH1XJyTPKzQ/7zIj6YQrJxDLsj5DZjgFE0o18K7JPN2VwQwt0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HSdxoi/6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HSdxoi/6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AD1FC4CECF; Tue, 19 Nov 2024 12:31:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732019494; bh=/Nld003I2yXGwv3RvPd4oUqhz91Qdlmk7WaiDxVoiXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSdxoi/6bTvRCqG0goWKMa0nDJK+Mi//UwLsdbeIgKg9WQPRbSiwv9cCspJ/ZGYKm 8NHL6r8dHUInfiF/VgnxeK4lFAwUXksMygcQrF6iqzPyhtsrnrTsjyPnmqIFjNbZqQ dCl2mere980erW+sIG9l1vNUU0+BUB8oCHtDnod2oFk0tWZcTn3rJbCv9NvhgM8yOL C+Wy2wJQ63Q36+iR4KQZJS72glxt63niZekAuCANc4Ja7OFJm0Td0AV0hxgsbNfK+C eJNW5PtvkueNc+99Gd/GkWR9ZkeXohISNRGPPv3Edid2iHQEIlyiAklXvvVsjGFFeV 6L55ZIZy3QB8g== From: Sasha Levin To: stable@vger.kernel.org Cc: cel@kernel.org, Sasha Levin Subject: Re: [PATCH 5.15 5/5] NFSD: Never decrement pending_async_copies on error Date: Tue, 19 Nov 2024 07:31:32 -0500 Message-ID: <20241118212035.3848-10-cel@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241118212035.3848-10-cel@kernel.org> References: Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: <20241119123132.7aeAdlK-aOkcpz2G_V7Z5G2s5l-XpwLx6GktNf3W8gg@z> [ Sasha's backport helper bot ] Hi, The upstream commit SHA1 provided is correct: 8286f8b622990194207df9ab852e0f87c60d35e9 WARNING: Author mismatch between patch and upstream commit: Backport author: cel@kernel.org Commit author: Chuck Lever Commit in newer trees: |-----------------|----------------------------------------------| | 6.11.y | Present (different SHA1: 1421883aa30c) | | 6.6.y | Not found | | 6.1.y | Not found | | 5.15.y | Not found | |-----------------|----------------------------------------------| Note: The patch differs from the upstream commit: --- --- - 2024-11-19 00:30:56.835091842 -0500 +++ /tmp/tmp.uWkVfqzE9j 2024-11-19 00:30:56.831399388 -0500 @@ -1,3 +1,5 @@ +[ Upstream commit 8286f8b622990194207df9ab852e0f87c60d35e9 ] + The error flow in nfsd4_copy() calls cleanup_async_copy(), which already decrements nn->pending_async_copies. @@ -9,10 +11,10 @@ 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c -index 5fd1ce3fc8fb7..d32f2dfd148fe 100644 +index 6267a41092ae..0b698e25826f 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c -@@ -1845,10 +1845,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, +@@ -1791,10 +1791,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, refcount_set(&async_copy->refcount, 1); /* Arbitrary cap on number of pending async copy operations */ if (atomic_inc_return(&nn->pending_async_copies) > @@ -24,3 +26,6 @@ async_copy->cp_src = kmalloc(sizeof(*async_copy->cp_src), GFP_KERNEL); if (!async_copy->cp_src) goto out_err; +-- +2.47.0 + --- Results of testing on various branches: | Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.15.y | Success | Success |