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 375F61E5722; Mon, 18 Nov 2024 21:23:49 +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=1731965030; cv=none; b=FypkAYIQ1cCFXq6afbNTmoj9uDAwrQff7timhxXvwqR14x8yI4O+f/i0QWod0p6Z5r4Iv9nfIcHSRrnpDvUwDn1s/6M7qT1z4hiE92wvvCY6GgtDccjdvg77PbSQLFLrUTEatmHEScm4KrmwAOBH2ZuaUURWrNvvyOrNaHRnhbU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731965030; c=relaxed/simple; bh=MmNZW2BO6/hZLJY2y2H8eprKc3nS4nEdDPVPe3ok95Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dUCuWITOZX+K4PB7LazHlBDY2sifRXuz+XML5SOoc/TXDDDFom0GFvNv9N6Je1D1b0GbqC4aAnmVHvmi0MB+TciApERxSIam0w5r+9HgCX1I/zdvMIsyKIvL9VFmrHvW+oR0Y8J5O5Hdb73WcqEBRkHPTqHfJGys505sgxfOYlQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VarhFoo+; 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="VarhFoo+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52FAEC4CECF; Mon, 18 Nov 2024 21:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731965029; bh=MmNZW2BO6/hZLJY2y2H8eprKc3nS4nEdDPVPe3ok95Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VarhFoo+bD8EV4vtfjsTHb0hnuw4tCK+DmR3lb9c/HeiGKg6BWpsdPbFJtWY94LOP F5z6NYHv7PtcxG2QcP7Dw3C/eK9thRLNkmGC3TR+V1IpjmL6czqFU3xaNcESMVLk8z V8OIrSheu4sAvxM+yJjhsx4laFjvwZFwo04Y5yVbEKwmHaxrTtyfE1LyqnFToGUzqs O5dtXpFO8mnOljyQegW4eZvIfBMWDoLAtXvwAMc/Psp7T/O6AaTHFF/bn8ovakHfE1 JragYNmIxGHKhVlFW35C0G1nnlfguHYQHyimhVMuwin4o8y/YyEHNtNZB3DVdGIfQP BFVpIA/VWyhZA== 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:23:43 -0500 Message-ID: <20241118212343.3935-6-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212343.3935-1-cel@kernel.org> References: <20241118212343.3935-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 70B011CC174 for ; Tue, 19 Nov 2024 12:30:57 +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=1732019457; cv=none; b=tdgWjC/Q8xEcZdWJqa74bEA9CkkRlQBLkT0Wbc0vGMjbrCgLCvq5ehiPN05E7cy645K6tV+xbBCplSfdR4cwtCIzUkz4lTvwJ/Qv6fKI+6uKugbtYhJefMIHOSZD8fqCBpn67w6Kftpwjb7G09XrCAVb43Rp4LtSFO20d8A0Vwc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732019457; c=relaxed/simple; bh=QyWjT85MOMWRMABcaPj+vodgRcSlwxmtr+XzjXx1W8c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M6zYvzx/8rlnhuEXfxfpSa1Y0jPAMLlRP3kqG8cmx0R507wvjHoOw+6hL7U55nCJFH0wwaWiNbcbSoRR2dXoyZq2fAq7Tpfo3fJArZxrWPfcR0xPVEqmyWptc+TzCMOLsBBv1vszlIG5mOShyxsW4oZ9TkWoyHT0zdLpNpqeTHE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=F49amnNh; 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="F49amnNh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86FD4C4CECF; Tue, 19 Nov 2024 12:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732019457; bh=QyWjT85MOMWRMABcaPj+vodgRcSlwxmtr+XzjXx1W8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F49amnNhAFF11FNoVaViX46sglYxXdLrSnreBcvP52SLFxwxnrdft4SEOMSCPa6P3 YWfgOyGL70uBSVxUDUOsI9MK1afTFtAJ6j/u7mi4SF+Uv8Q0qYVBUqwRUmM7F82bVD O8FVyHy8Fe6FvUf+wMc0tRlA7s1ZCnkJ0dlxpxrE/LyCJSFfaJrfJd+JXZ28chfxzh 79KOP+7PPoFvlquLSR4+8o31SoizOVCjTXxc7xkpCUOc4+FUwL/RxEZUCS+Vz8pB4+ TLVkxaco5AbkOezpgbrvKaJdXnFhEYMDT4ZWZdlkp4BVOx03+H3z4hyzyd8fgMLneL YnxXlMbw0UNoQ== 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:30:55 -0500 Message-ID: <20241118212343.3935-6-cel@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241118212343.3935-6-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: <20241119123055.1Cq8juCC0T4FlmVPwfchhkx9V7el_p5TF-NEPA-H1YI@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:52:27.986555873 -0500 +++ /tmp/tmp.B39I9zfOoW 2024-11-19 00:52:27.981078429 -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 |