From patchwork Thu Oct 31 13:40:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13857932 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 4DA7F13D886 for ; Thu, 31 Oct 2024 13:40:12 +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=1730382012; cv=none; b=aywpUG7YcUwG2MzSw0PnTtPThQtc3tFqorON1OB35Uj7ocvsNf7gaKQ7mvav+fMRcjiwbGiD9cFPyaV9lS/qee0nHft2HpmtBsg4VcCn01xSB6lGkMY+6Oatv9foyh7i/nVFaFHtWXr4bzOj7jfmJA4O/bwS4H4LKVbVL1oIPc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730382012; c=relaxed/simple; bh=jDPHsTqM4u1zffi9aGCCX5Y00anFzQ8z+399eg6DlSY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m9J1R7+WSO5WtFIk10YBOZ476VGRKaD8oKmi0e+k41DIPab8cGqUi3CZWnOV2bU51HZqjMX+KDWxqRfind2GhfdHo3rTnSfAMNmtAsAwdyfPg74oEdrwJY9zxOmWvz71PyK8pcG+RqLal+s6gFmqcw8ia0h1LEEvqhwgDhVdZgM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TAkCpXdF; 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="TAkCpXdF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33A6EC4AF0E; Thu, 31 Oct 2024 13:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730382011; bh=jDPHsTqM4u1zffi9aGCCX5Y00anFzQ8z+399eg6DlSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TAkCpXdFxMywzeSytwkvhJ3Kv3y4Tju0ImOFhxmP+gPDDu31BV0TjHNBVkTk/9AWI gCQlOIYuqjwcEXo3QCNVSFySgo5JrR0sVCUgSFbzIKG6+H4RdgFQ113qFw+u0XzV0A oVQ85sJTMPwuTJyNxqLW0R5JFzYcPmNkZt/efUynvIu1n5eOqvQgQM9tiex60WoUf4 HneDGHAyBHxVEhKIiW1LgTPcOsb0CjaySC9CumFGxZ1bAsSaBIX5kOViGiGbpp8BtA IwsbLlOmYN8RkBU5gnjWNnhXZYlqQ3v065fDJcoQFY5Fg237tE429TKa6aswEqcMK9 8zRhFUVSNeLYg== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH v3 1/8] NFSD: Add a tracepoint to record canceled async COPY operations Date: Thu, 31 Oct 2024 09:40:02 -0400 Message-ID: <20241031134000.53396-11-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241031134000.53396-10-cel@kernel.org> References: <20241031134000.53396-10-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1379; i=chuck.lever@oracle.com; h=from:subject; bh=AKWa+nOgmQoiN8QUBVa8o/eESoN74iwZpXr9UQyrS9o=; b=owEBbQKS/ZANAwAIATNqszNvZn+XAcsmYgBnI4i2Psqa6CNB4Q6b4uWArfE8EzFJ9PPLVrF41 n5ox1fwJQeJAjMEAAEIAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCZyOItgAKCRAzarMzb2Z/ ly3QEACvatI0U/AnrR7swUMns2kKoUeaNyiT2aVxLLBTBS1wjiUmfhBocVX2o5YQ5DThomwuaFB Yo2ah75vu4QPKU5HIcfhcCSSZJ24Rc8RVoP7mk0vKNdyxfgi9ofZ2nIHfwq6lLVMnWwxxIAOLRG fpHStfxVBJaVC+ipOjFXYfdbjTcF9hfQUX7U0EB9EXpk01oW7ii9xBuf3zSAsof+cRIXbzfPGkT 4dwuD6VXgAs7PqXqCXSSybGkt8Kqlhr1Eb8D/tfT1GIk+Bew/Au+8h8rgrdER1i/Q7aJjmCeeMe Whdm0JZKcreGQQmWv+9MYGo1Q17hdgGHO5iChR9ikuj5ryXdd4NL0NHzZwm+IKfRws8GCe0iTJX RafbmgbR2BrXRIcvfhyCS/1PR9/4q/nnaRXvh2b4Nk5T02v3yT44D9cNEkSRZLD63q9crlM8zdF ZIk7/yI3Kf2SRQCBRrUVl6vUTFNPmVQi6smm6UXFx9c5J3DQiKychKXYFKmv51wvr7HQUynrbWY lXUXGKpr4aSF7JbpQ0GiCoHtvKhzRWEjwDqhgOzbwcV90U5ryrn0FtNJSCMCWqJWFpSHHCVekBE ccnHUomx0kUvjtVsyg8WoldFIfnR//od9D0+Mxww/+quVyu3Mj0hPi8xtKtALUrRKmww837DYZZ 4O48qGj9cIeUurg== X-Developer-Key: i=chuck.lever@oracle.com; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97 From: Chuck Lever Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 1 + fs/nfsd/trace.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index d32f2dfd148f..9f6617fa5412 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1287,6 +1287,7 @@ static void nfs4_put_copy(struct nfsd4_copy *copy) static void nfsd4_stop_copy(struct nfsd4_copy *copy) { + trace_nfsd_copy_async_cancel(copy); if (!test_and_set_bit(NFSD4_COPY_F_STOPPED, ©->cp_flags)) kthread_stop(copy->copy_task); nfs4_put_copy(copy); diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h index b8470d4cbe99..acbc7f37cdc5 100644 --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -2232,7 +2232,7 @@ TRACE_EVENT(nfsd_copy_done, ) ); -TRACE_EVENT(nfsd_copy_async_done, +DECLARE_EVENT_CLASS(nfsd_copy_async_done_class, TP_PROTO( const struct nfsd4_copy *copy ), @@ -2301,6 +2301,15 @@ TRACE_EVENT(nfsd_copy_async_done, ) ); +#define DEFINE_COPY_ASYNC_DONE_EVENT(name) \ +DEFINE_EVENT(nfsd_copy_async_done_class, \ + nfsd_copy_async_##name, \ + TP_PROTO(const struct nfsd4_copy *copy), \ + TP_ARGS(copy)) + +DEFINE_COPY_ASYNC_DONE_EVENT(done); +DEFINE_COPY_ASYNC_DONE_EVENT(cancel); + #endif /* _NFSD_TRACE_H */ #undef TRACE_INCLUDE_PATH From patchwork Thu Oct 31 13:40:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13857933 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 1E31813D886 for ; Thu, 31 Oct 2024 13:40:12 +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=1730382013; cv=none; b=S21TpVTZrM7qnldp34q+che7xtAywxJg/XrRLUjCVRL02ttTYJxgo7tLmUZ8mFmfWejedqwcy/5qeTEVoWDXHwtV3Gwjc2eyaB/wK0eVHJgzBLEq5c/fDS6HQvXo9F+7BQhYTgHnm2/KRKnqNkuEi5il98N6+vjyyThpnAZXd7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730382013; c=relaxed/simple; bh=NLTfNQgpIrN8nSWD2KGZi3NiduOAIgMC5LCO/UqVZqk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CDWvNyhJ/calNZqm0rngfHJKL4Kk5PErbJCggBA3n5/kCIcxPeau6HNV6sqzirTQ39K9vdxmQv3po7UB4J2QRioosNjZ2dNjvJSJIkjx8QmwZVWebzgfMlAwBBPLzqZyo1NcapiSMMf4qG0yBdvWtZ9m1gQgb6l7rElBasOAvzA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=REznCYkN; 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="REznCYkN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28886C4AF10; Thu, 31 Oct 2024 13:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730382012; bh=NLTfNQgpIrN8nSWD2KGZi3NiduOAIgMC5LCO/UqVZqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=REznCYkN60z8gEUlTxTHW3xRdNIQNhxuDEvUJQ3csv/d5fz6VGS5PnJHcRkPvr68Y CxXo/hI9zdTL5jq2pqMqIVjZjKsSgFSQLqKVoSWB8LfQ40EzVmLdE7DVkagN2mFtY8 MwuYrDoyMXNOb1e+BuJ4Hav5dB4bINfkKYUnQr6i024U1bttI39KueblaR62+bvyNn JuRhqFhalukQJ5SLIswQ7q67rin1xd1HLlhOZ+bsPa4/T7oWQdvWLWM/1KIRfWNDut wwXZivpf6gUI7sf3Ymz1R+ewiLPS4jJk9DCuAiUtjSt7acQj26Td49R/3PxBGZLmpV wD8MQmonDYVYQ== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH v3 2/8] NFSD: Fix nfsd4_shutdown_copy() Date: Thu, 31 Oct 2024 09:40:03 -0400 Message-ID: <20241031134000.53396-12-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241031134000.53396-10-cel@kernel.org> References: <20241031134000.53396-10-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1541; i=chuck.lever@oracle.com; h=from:subject; bh=R/WZk8vkBpzwiEAkmXEKVL+foWiT5chmxIeSH1OQJdU=; b=owEBbQKS/ZANAwAIATNqszNvZn+XAcsmYgBnI4i2xcaWe1nJSbWJB6vFJ1GxIq44a/yvlwm8v KyNDXhG0zOJAjMEAAEIAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCZyOItgAKCRAzarMzb2Z/ lyVFEACQ3nzwY8CmP16QuHVj/eZ98gUfOqOQXz04r4vrzd64I/5tjSUfZ7eDZeFIKCMslCu8d9g GrwdzriBFshoJ//qN8LtJSYwYASYRvHDqnJFD4LOV/fLMH75OVxUYx7TMd7ttSnPRl5+DLM4j5d or/dV+5qUGaTBO5V/7wr0df7TE2aMrQW6n/2+SYJn2FT+bXipDM+Ts5kys9y6bK3ULu0elT5AKq CzELAsBm6+arnJAMkWSPHmfdkCx/oD990nfX1LKgQ5wthMCX8I8CLRRidOy3MjI8R/5930O0HzH 3NuyrvLQqzCoOx74cGVmclOUdb3smKF8kSbP2IXPuOo2wwdFasaV0WJd08RWysH9MF7kcr1iRGr OZJqawkzVL3o/BXSTtArigmM2bp5RG5+eZwKTeS5VE+3Ug3+uQ5sCxNaYEORm3lPsC0ppZL1diD 3rTFWU1Yxf6XiS6lFfzZYGaW+X6AcLjuRDLAoPLoUNlyGTQ0upIrrUx40XPHWNe1Br7IYwOtDB7 rFC2+CFhOGNZLqPgLkgMUk59dkxkgofroV0i1XpjFDb0ILwYB6w5oUNZ28zjg693GKicqXtnJfH J0V36FeX7/lLy8D3wqWJRoOjb37Tl3dNoe/V49WQ6ZOqwfy0j4FY75hf0kVLzxQG5I2BPQUXIeI +PVPMAIKrvw3iXg== X-Developer-Key: i=chuck.lever@oracle.com; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97 From: Chuck Lever nfsd4_shutdown_copy() is just this: while ((copy = nfsd4_get_copy(clp)) != NULL) nfsd4_stop_copy(copy); nfsd4_get_copy() bumps @copy's reference count, preventing nfsd4_stop_copy() from releasing @copy. A while loop like this usually works by removing the first element of the list, but neither nfsd4_get_copy() nor nfsd4_stop_copy() alters the async_copies list. Best I can tell, then, is that nfsd4_shutdown_copy() continues to loop until other threads manage to remove all the items from this list. The spinning loop blocks shutdown until these items are gone. Possibly the reason we haven't seen this issue in the field is because client_has_state() prevents __destroy_client() from calling nfsd4_shutdown_copy() if there are any items on this list. In a subsequent patch I plan to remove that restriction. Fixes: e0639dc5805a ("NFSD introduce async copy feature") Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 9f6617fa5412..8229bbfdd735 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1302,6 +1302,9 @@ static struct nfsd4_copy *nfsd4_get_copy(struct nfs4_client *clp) copy = list_first_entry(&clp->async_copies, struct nfsd4_copy, copies); refcount_inc(©->refcount); + copy->cp_clp = NULL; + if (!list_empty(©->copies)) + list_del_init(©->copies); } spin_unlock(&clp->async_lock); return copy; From patchwork Thu Oct 31 13:40:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13857934 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 09E9B19F108 for ; Thu, 31 Oct 2024 13:40:13 +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=1730382015; cv=none; b=MEJSFdhM1Tpl7PROms52Rv5eYZwi3/k3PFOhbRvyWtUeAgJgdb931qNivjyAB77KANEck+AEQoSrjHjH7vYJXhI61CRQNxgleh50kRdu4DNMEResR1mcKklsODq/UymMfvecVqOWcyFf/JuaiUsSdHTSFPegOi6hBzRYTHOppKo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730382015; c=relaxed/simple; bh=J+NsoUvZCq9snDkoyG4wmvIivL3WvLvUOk4S3rCsU9M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H260jZo6aePiP/ablWO7nhidsKhpuCum5UXg/5Z3p6KyYmc8MJaVB27V6bVLFt0MXA7iEJHtvIDSiWl0cfnNXchWvJTtiP+eYwJvI91+HAMKbTcAhzzTax9arvLiu490ve2ZEBJ0E1FfFMFoeIA1Q3RfsPB2C8f5SzoI99wJlC4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=omDvX5Au; 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="omDvX5Au" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 191C8C4DDE6; Thu, 31 Oct 2024 13:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730382013; bh=J+NsoUvZCq9snDkoyG4wmvIivL3WvLvUOk4S3rCsU9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=omDvX5AujhsnVXioc9yrr3QJmKkQW/+W+nrEa84uQpCRRkn6oqA7m4GpdMMox8T0M j3Cpc01PMp1HNf728jHNiGDpkYjSQ3EKQUdDE59xnHpGhTPqwKdr6w/hfjq2UsEAff +t4GzRHDKMcoP6LyJ16tkOIDUAcXSAtNZoMPsIhxrvbyWXSsclBzjtG7dUfpspSYS1 ILwQMPg7ZIh6vAdj35NY11OCDXaY636Y9HTeo1KOSgpjwPYp05cwiL5ETI1iQb0cqW 42xMBDbz8yKwr6N4YRar0/uCisXEp/QNUj0n/k7p+MEHCU7bXBl2+uF0pXhlKQiawN i0n6g8Dl+3vEQ== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH v3 3/8] NFSD: Free async copy information in nfsd4_cb_offload_release() Date: Thu, 31 Oct 2024 09:40:04 -0400 Message-ID: <20241031134000.53396-13-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241031134000.53396-10-cel@kernel.org> References: <20241031134000.53396-10-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3584; i=chuck.lever@oracle.com; h=from:subject; bh=DLreE/k52prrqwxP+NA2902w5TLm3ZQvn0lPUwNXj7M=; b=owEBbQKS/ZANAwAIATNqszNvZn+XAcsmYgBnI4i2pHuPB1+pXbgYvOWWBLmwkSbL8YLD++r7a EEpnnHXoN2JAjMEAAEIAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCZyOItgAKCRAzarMzb2Z/ lwFoD/9jvZw+pk28DMqPRfaYcNC7OY45dsFMX8SxsaporJ/gargc2eA4CleBYnpO294MmQD0a/l qKgPN7yB1++UR0t0gGl/UTUo31q4OUv3/U4vKdX3IpPjlxnLJh3SFBbvzQU+j/kFquB2HD1/bmY +00heU3Bz3ly+pLAeZCrvj3SWK7cdUL8RMBy5PEanu6UuKqhuKLg6td/RFgenQGJMbeA+bWHMgh 1jaNHk30qDntTVHSLhrklc/oshVxKB/l807zZkckudvonts2Ps7B+CdxgTourtOQIn2duP1g2Pm zWzuCw4hzre1zMcP8nLNRKR7tVEXzydAL3/yrpXYXE9RiBmKn2+fLWt2pvZ/ix1CVcA6QFPh+WZ lawA38PDIMafU1jIs/W5ymKDUrgW738zmU7gzKRac3dzbye9jfPOvJ+Fa22BLWYQ2xvf31/UjmR 2e3dOF/OO03/9cQwj16X2No38fnT4UCuG74yT7le9FJCdub1N2/RQ09MSQUaVDuSGJZTTf5YgV8 4XJJAOAtLl5HzKnHk8VUDUHqOR4UAccrLk8FDY1A5x8ZAMAWOGFfiXIn7Av9elRAO4xpUKVzuPD SDOl9vmyBW8dUIEKt15lmQiXnoBqzSAqrn+lKNgmIaO6/rVL2a54JZ0z1EnqBrUKifw/hL2VtHQ VnvNZlJfaP7G1qw== X-Developer-Key: i=chuck.lever@oracle.com; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97 From: Chuck Lever RFC 7862 Section 4.8 states: > A copy offload stateid will be valid until either (A) the client > or server restarts or (B) the client returns the resource by > issuing an OFFLOAD_CANCEL operation or the client replies to a > CB_OFFLOAD operation. Currently, NFSD purges the metadata for an async COPY operation as soon as the CB_OFFLOAD callback has been sent. It does not wait even for the client's CB_OFFLOAD response, as the paragraph above suggests that it should. This makes the OFFLOAD_STATUS operation ineffective during the window between the completion of an asynchronous COPY and the server's receipt of the corresponding CB_OFFLOAD response. This is important if, for example, the client responds with NFS4ERR_DELAY, or the transport is lost before the server receives the response. A client might use OFFLOAD_STATUS to query the server about the still pending asynchronous COPY, but NFSD will respond to OFFLOAD_STATUS as if it had never heard of the presented copy stateid. This patch starts to address this issue by extending the lifetime of struct nfsd4_copy at least until the server has seen the client's CB_OFFLOAD response, or the CB_OFFLOAD has timed out. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 17 ++++++++++------- fs/nfsd/xdr4.h | 3 +++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 8229bbfdd735..39e90391bce2 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -57,6 +57,8 @@ module_param(inter_copy_offload_enable, bool, 0644); MODULE_PARM_DESC(inter_copy_offload_enable, "Enable inter server to server copy offload. Default: false"); +static void cleanup_async_copy(struct nfsd4_copy *copy); + #ifdef CONFIG_NFSD_V4_2_INTER_SSC static int nfsd4_ssc_umount_timeout = 900000; /* default to 15 mins */ module_param(nfsd4_ssc_umount_timeout, int, 0644); @@ -1602,8 +1604,10 @@ static void nfsd4_cb_offload_release(struct nfsd4_callback *cb) { struct nfsd4_cb_offload *cbo = container_of(cb, struct nfsd4_cb_offload, co_cb); + struct nfsd4_copy *copy = + container_of(cbo, struct nfsd4_copy, cp_cb_offload); - kfree(cbo); + cleanup_async_copy(copy); } static int nfsd4_cb_offload_done(struct nfsd4_callback *cb, @@ -1736,11 +1740,7 @@ static void cleanup_async_copy(struct nfsd4_copy *copy) static void nfsd4_send_cb_offload(struct nfsd4_copy *copy) { - struct nfsd4_cb_offload *cbo; - - cbo = kzalloc(sizeof(*cbo), GFP_KERNEL); - if (!cbo) - return; + struct nfsd4_cb_offload *cbo = ©->cp_cb_offload; memcpy(&cbo->co_res, ©->cp_res, sizeof(copy->cp_res)); memcpy(&cbo->co_fh, ©->fh, sizeof(copy->fh)); @@ -1790,10 +1790,13 @@ static int nfsd4_do_async_copy(void *data) } do_callback: + /* The kthread exits forthwith. Ensure that a subsequent + * OFFLOAD_CANCEL won't try to kill it again. */ + set_bit(NFSD4_COPY_F_STOPPED, ©->cp_flags); + set_bit(NFSD4_COPY_F_COMPLETED, ©->cp_flags); trace_nfsd_copy_async_done(copy); nfsd4_send_cb_offload(copy); - cleanup_async_copy(copy); return 0; } diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index 2a21a7662e03..dec29afa43f3 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h @@ -699,6 +699,9 @@ struct nfsd4_copy { struct nfsd42_write_res cp_res; struct knfsd_fh fh; + /* offload callback */ + struct nfsd4_cb_offload cp_cb_offload; + struct nfs4_client *cp_clp; struct nfsd_file *nf_src; From patchwork Thu Oct 31 13:40:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13857935 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 09E5313D886 for ; Thu, 31 Oct 2024 13:40:14 +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=1730382015; cv=none; b=OIx2XRrKZXlKLe2FmYuodm9mivqvxkF2ohTmbIPbjSdQPWECAZaKpb1R5hiBGoyAMEv4ayIqqqeTOB5XXBCzv8YlkHWdSOJS8fVAtM3WNOSpwg4xfYGVIrgpQj7HcUaxxZv8SKnxuwR5Q1rfQK8auK7tOOrmUKiqJjTNV7UWgEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730382015; c=relaxed/simple; bh=HfR3QCu5pj0pSXZ4OQzd8xq8bQ6fJkqcG/9EvwYWiys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KqtFJ4WUVyyfkv/HKOp1GUe/MWPz+Q0PFGgEqh7LvcIfYgl4kZArNQxhFUgJ5TEbKQ42CQhfIGlDiNk4WE7KFDk2S38hpD+S6sFMEYqgWUA0JBTPQR7Pf4J5zsksqsMOk8C6KIeVf95k81LTFT+jupZAD4I58T42oiZ98w/ZBeM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bPiLnvPg; 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="bPiLnvPg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 101E3C4AF10; Thu, 31 Oct 2024 13:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730382014; bh=HfR3QCu5pj0pSXZ4OQzd8xq8bQ6fJkqcG/9EvwYWiys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bPiLnvPgkHiPo0R1HS9ZdXWqkDfn765b5n4Yyl8pVn69Hxz/c3I6GCz1tk1D0c5jk avUxyD2LSxq4b0WZnYFO7gI0FA18NlxxZAme6wKpr5ILgnPB0yw0EDBo0V23gzs9WD IuG/sV87hLrkzU4iV8OZswlMofN/oRrzeYPWpOog9tH9y6wNiQyvxNOQv9oEEFYGjB 3Pw/TxTBQvBqB5LpI+xtjrjZBrnn1dUyavku9PNsBUrYPDM6XYohZC79/Mh6gETyGn 8LXgf5bc7BPdDNL/lXKemkcBabumPq4aj63WfGZiyw6I3ocnjAXDL8OuRBJbe5+8N3 Z5qgUAz1zt3iQ== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH v3 4/8] NFSD: Handle an NFS4ERR_DELAY response to CB_OFFLOAD Date: Thu, 31 Oct 2024 09:40:05 -0400 Message-ID: <20241031134000.53396-14-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241031134000.53396-10-cel@kernel.org> References: <20241031134000.53396-10-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1622; i=chuck.lever@oracle.com; h=from:subject; bh=F4Gz3kuuKWspdsZMwJ3nKDesQ4+c3xnUivyumfWdfUI=; b=owEBbQKS/ZANAwAIATNqszNvZn+XAcsmYgBnI4i36vFfp1xfuTSnfdtu7qileUThf9wzinzPd qMKGhJ2+huJAjMEAAEIAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCZyOItwAKCRAzarMzb2Z/ lyNeD/9nZm9acHgYm9TXVXpOJMoIik0GGq5/EjeQtnBVg9Orgxrr54ZJgHKtpjs20FJP6eNYSFA EX9MVeGPW3T6wscDtcNAZ0wsXGT4qp7LPxiPF5BWbsIKtHgQCf4tNFcadfhNwcfVm0QNtPljFRj naSRQdIcjDtS1TDbv+aQm2AK3pOo9lJwCpjg1sBnlhI4bdEgvqzuGi+KsZJJkAD3y/Qk/LUl8M6 hH7l5LHGDS7PzNq6DdneOtYbXtnUri+L2OinxqAFfL8uan4W3vDn9kOPdD0E3HIO7lNa1vBzCk6 TEi9x22PNGTLxyxBK3L1xigTsSXFP+Ar6XKkl9PeYZrtrvJByhDTcrvgUOc3aEuvsFLf0myZrsC KkD71tj/QSJYXQtQqDbYq/8mF6GrRs/2SPQTHxXnji1tLaX13VYcu8sM9DiV+tYz/5m6KfJDxfs CNYK1H77t94WV8eSevdpFlpw+/yV3d/p81qdVMtl2Iv7UyDYgofcW7xL5FvzxYjLO8nVzy2cqL/ QG8LygFcsYtd2Cp6w1+JLgsVY2ivl2yDRKiYKdV+y+atUWQ99I2vMlirXzBv6PgNu6E8K3Oe6nS CkUChWMo4kc1Nl39QyRwiGdGpZqw9pqNg8ft2hv+w69/A7lUFQXhrfbity3W56/2KBuwP0mGTCA zbpXN51li6ZaqDA== X-Developer-Key: i=chuck.lever@oracle.com; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97 From: Chuck Lever RFC 7862 permits callback services to respond to CB_OFFLOAD with NFS4ERR_DELAY. Currently NFSD drops the CB_OFFLOAD in that case. To improve the reliability of COPY offload, NFSD should rather send another CB_OFFLOAD completion notification. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 8 ++++++++ fs/nfsd/xdr4.h | 1 + 2 files changed, 9 insertions(+) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 39e90391bce2..0918d05c54a1 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1617,6 +1617,13 @@ static int nfsd4_cb_offload_done(struct nfsd4_callback *cb, container_of(cb, struct nfsd4_cb_offload, co_cb); trace_nfsd_cb_offload_done(&cbo->co_res.cb_stateid, task); + switch (task->tk_status) { + case -NFS4ERR_DELAY: + if (cbo->co_retries--) { + rpc_delay(task, 1 * HZ); + return 0; + } + } return 1; } @@ -1745,6 +1752,7 @@ static void nfsd4_send_cb_offload(struct nfsd4_copy *copy) memcpy(&cbo->co_res, ©->cp_res, sizeof(copy->cp_res)); memcpy(&cbo->co_fh, ©->fh, sizeof(copy->fh)); cbo->co_nfserr = copy->nfserr; + cbo->co_retries = 5; nfsd4_init_cb(&cbo->co_cb, copy->cp_clp, &nfsd4_cb_offload_ops, NFSPROC4_CLNT_CB_OFFLOAD); diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index dec29afa43f3..cd2bf63651e3 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h @@ -675,6 +675,7 @@ struct nfsd4_cb_offload { struct nfsd4_callback co_cb; struct nfsd42_write_res co_res; __be32 co_nfserr; + unsigned int co_retries; struct knfsd_fh co_fh; }; From patchwork Thu Oct 31 13:40:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13857936 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 1C5C113D886 for ; Thu, 31 Oct 2024 13:40:15 +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=1730382016; cv=none; b=CDTb1KtaVw7zWK6ER1v6DSLedVLi+3EX6Uo7qNys+oRkySTD4Ki5W1zHsgNd3Km4et6e7CarsDZ6JwcxiYa0p7fzFhY9C+eZfhnWX0liXjQq9h/AFpp6WtXsRNC1LNLng9NYUfpak9kKaNStqhjDanXWTvUFBfUzPPt+JkrYR/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730382016; c=relaxed/simple; bh=Rw6lt8gVnbtsze7NI6sN17Je7YcVfKpkJqOxuQIDkZ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oE0R5bk8QQ3lFeiUucL5rPzbq75wVMLY85yoXoMuVXQxdTXP7FmdJ24k9qN0BVQeqTipeefYQhCUmIoth+XwpGASjr+mp92q+xrE09LpUzz4Y73zNVlm4GIuj6vDhJvtoG1gF6VJYJUhxu+NbxDH3guwy0OJmj3yS4Lgo1yVfyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kzazMqlw; 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="kzazMqlw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EADABC4DDED; Thu, 31 Oct 2024 13:40:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730382015; bh=Rw6lt8gVnbtsze7NI6sN17Je7YcVfKpkJqOxuQIDkZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kzazMqlwv11ldGyI2qD8htwEZs0CEdQPK8pzW5ZBhKmXnlADfdue7Y2S/kOXKOBLk 1Gbbv1oLsznpyFw5gItPfCvECLkfO3CTHQXIdrz0qIQ/GdmpiqYqkRQctkHCx4s1/l KmXLkzolRks3/I4llgIDpFtTcHe1Fdk48gIZ1tG/P63ZYzPdyYRwdMzuLBfzZayBbD q+XxzCdFIGX4ODqhVluK01xFF0a98wVf8gev9yMHjXv3CD9FOJihvnGzb0WXlSGhbf SQiC4YgfnkA9IZvibtQUatwVV0J1TR1YTSeytOtsrChmrxmknxFQJfDIv/WA6S9f0I y0xttB8X/OxGw== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH v3 5/8] NFSD: Block DESTROY_CLIENTID only when there are ongoing async COPY operations Date: Thu, 31 Oct 2024 09:40:06 -0400 Message-ID: <20241031134000.53396-15-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241031134000.53396-10-cel@kernel.org> References: <20241031134000.53396-10-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3168; i=chuck.lever@oracle.com; h=from:subject; bh=YOTZEvbpL09QAoMAsaifVC3ocwxxfIpaEoV+F8nsVGQ=; b=owEBbQKS/ZANAwAIATNqszNvZn+XAcsmYgBnI4i3QOa0vQAa0FwHWnKbhBK5GHaYkTDhtl9hO QJAN9GHRy2JAjMEAAEIAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCZyOItwAKCRAzarMzb2Z/ l2ppEADBHv6ibGdW3RdNyY8dPt/3NNwQ+R2txnZrjbX4agKi/1i0rBfxtkGz6aZcvt50MsrZ2qd EEQTGiSqSO4cvelA+ml4uHUlx2TPYQ1qAWK75A8+L0R3EcSvNafa/YbZekySkwjP2Psw+5EAGcE Uv6Ez+ETCW2qkNqLDL1mdXqR3VXCwUqcAwt8J6cGm2lNeDtDuuA4EdOfZZLIBh7KkclVaZr18a1 VtBBXr9dUnFjirMaDMGpLGt60K+kCFEf8yOt469q8vf02xRefM4E6ZcyDAwHhlEd9iLssBxebAx DT2zwpMQ61uT+ywWGe/jGYXSkm/fD92Qv8yKtTLmMxu9uVMePdgSe13G522XqmAXjK+cYimoLC4 dmKfklySIFJ/ucHUbG91HXWQlHd605U7LZOJzM6FNiAmpyE1IzAD+/p2Ci/J5JUpbCDAgJGQdYo fdjwnp23b7VgwwoJd/nJehggieXp/7YTR97tPrur/idvcZq+YzWDwGtJORLYve3ExLy+n7garYY NW5QRDZsiC/o60XStHeOkb7/pRYp+VxwOuUknQ+r9RJdMieK64P255Wp1PpFXz2Ny1TZhk5770t LFkCv7sf5yXhP6nYey7ZkzR7KkbG1ChbBLep1MRI1xhvHnfqM9ha+6aj4bl2C3I9+HJ3o5ac0dT rVTOKKZPyjcvnlw== X-Developer-Key: i=chuck.lever@oracle.com; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97 From: Chuck Lever Currently __destroy_client() consults the nfs4_client's async_copies list to determine whether there are ongoing async COPY operations. However, NFSD now keeps copy state in that list even when the async copy has completed, to enable OFFLOAD_STATUS to find the COPY results for a while after the COPY has completed. DESTROY_CLIENTID should not be blocked if the client's async_copies list contains state for only completed copy operations. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 30 ++++++++++++++++++++++++++++++ fs/nfsd/nfs4state.c | 2 +- fs/nfsd/state.h | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 0918d05c54a1..4d44b785a580 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1278,6 +1278,36 @@ nfsd4_clone(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, return status; } +/** + * nfsd4_has_active_async_copies - Check for ongoing copy operations + * @clp: Client to be checked + * + * NFSD maintains state for async COPY operations after they complete, + * and this state remains in the nfs4_client's async_copies list. + * Ongoing copies should block the destruction of the nfs4_client, but + * completed copies should not. + * + * Return values: + * %true: At least one active async COPY is ongoing + * %false: No active async COPY operations were found + */ +bool nfsd4_has_active_async_copies(struct nfs4_client *clp) +{ + struct nfsd4_copy *copy; + bool result = false; + + spin_lock(&clp->async_lock); + list_for_each_entry(copy, &clp->async_copies, copies) { + if (!test_bit(NFSD4_COPY_F_COMPLETED, ©->cp_flags) && + !test_bit(NFSD4_COPY_F_STOPPED, ©->cp_flags)) { + result = true; + break; + } + } + spin_unlock(&clp->async_lock); + return result; +} + static void nfs4_put_copy(struct nfsd4_copy *copy) { if (!refcount_dec_and_test(©->refcount)) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 551d2958ec29..cde5ba69d7a5 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3487,7 +3487,7 @@ static bool client_has_state(struct nfs4_client *clp) #endif || !list_empty(&clp->cl_delegations) || !list_empty(&clp->cl_sessions) - || !list_empty(&clp->async_copies); + || nfsd4_has_active_async_copies(clp); } static __be32 copy_impl_id(struct nfs4_client *clp, diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 35b3564c065f..6c84c0900ec4 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -742,6 +742,7 @@ extern void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp, extern bool nfsd4_run_cb(struct nfsd4_callback *cb); extern void nfsd4_shutdown_callback(struct nfs4_client *); extern void nfsd4_shutdown_copy(struct nfs4_client *clp); +bool nfsd4_has_active_async_copies(struct nfs4_client *clp); extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(struct xdr_netobj name, struct xdr_netobj princhash, struct nfsd_net *nn); extern bool nfs4_has_reclaimed_state(struct xdr_netobj name, struct nfsd_net *nn); From patchwork Thu Oct 31 13:40:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13857937 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 B034519F130 for ; Thu, 31 Oct 2024 13:40:16 +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=1730382016; cv=none; b=CUb+qjMajNyVbomvjJA0UUi9zzs430r3en/4btwOfS9cxtazG+SD8KjxZYE+LTwcRlkfg4yEC7pG1RxojCEXN7Y4N4BrIlFrRi+U/o8xJ1rxEvO3n7lp02MMwfcukE2K9DCeFhWXnH/ebjGCHnR4tTSNIAn3VRbqnWkfrmm0IiU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730382016; c=relaxed/simple; bh=OsCYMSNnZ34v1gQ+64srqhC50ENezlFgHBHSf6X0Uhk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SM+W7a2RIx0HNZxAhk2cIqBu7Pnh1mJM0nuv/Nmxg3Bo4DTKCnyqyKZ0GGggPxufdxpu4+X66OBhH2HLs5r19KklhYe8mUas8UH8cLvRls5X3ueetokuPQMpon3b1H08DLJaRTXLHGG2NHycFhFss8GNVZ9mpmQjRgrxZI8IKVI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y1mfIzI2; 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="Y1mfIzI2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D320BC4DDE6; Thu, 31 Oct 2024 13:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730382016; bh=OsCYMSNnZ34v1gQ+64srqhC50ENezlFgHBHSf6X0Uhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y1mfIzI2hC8wo6/C6qZYqn5+45b6tCy40HhKI4so0dY71/W9coKOBZpkObYYqIas5 Pmf3femV3l4od6QxOR65WoKMGS90Y4aTD2dhEgdc8D8t49dwrZt7QmdWtgUr7u8eXD WhzleRf+wSWaBog3b0uWN5T/iTu2O0YMIq7YVXLT/15zVirTcq0HkeHzYb8uA6JwWT ht0FgYftSjg1KJX+LMV15S+HyQu4AALOU3ECRO4uvjW2VjkoIf+jzTNYPAIdH2MYLF ZjLHJhJFm1KIk6Lf6m99jjTAxJ2gv2c6bH0wkoZfcjWsFT+YbpUb12QOg1xUPTqoyd TOmfda/JxUdlQ== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH v3 6/8] NFSD: Add a laundromat reaper for async copy state Date: Thu, 31 Oct 2024 09:40:07 -0400 Message-ID: <20241031134000.53396-16-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241031134000.53396-10-cel@kernel.org> References: <20241031134000.53396-10-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3786; i=chuck.lever@oracle.com; h=from:subject; bh=ia8JObjt3kRLEXz90vAZl2p42J04XE0H0XL6VfSEHSM=; b=owEBbQKS/ZANAwAIATNqszNvZn+XAcsmYgBnI4i34W8krbq6239Gaxx/kFPbQlGR2IpkVUnyM 9ZEF6Ia9jiJAjMEAAEIAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCZyOItwAKCRAzarMzb2Z/ lztVD/4wzFMyE2v8FGyrecjbjxIgd4adf6tiZWFB/f8MjkBUrHNwTG6+XmYQXkixw7MFvak3YMn Rn8kRd3lxBImWATYXVqik2ZS7WEWv72R+miEJJ9lbWjHm+dN3gdiKD8Pd84iYX29z7UMGrtdXp/ Fc3NgeTvlrnGnE9KSaEDmbwCFcHmj9+JGxKV3Y+qZcPsomUlbsTMWnQbNzkUIuVrYs+bgGxbjGz DPWzjim5UKeWvGkTxEUXVNFQ7+D/SkhgDe/E/SHqOw5uUBhvz/kNrob9e+GzQ3yKz8ZTA72mdkd NvZjcVgQYHn+LCFrQmJARGPtPNzVjMs9hwitO8nqyQ0hPMbPW7XXZUNMOFzWVU7GV/zPOo7guJM ad+TLIPem7rAddq5h9Lu69QT33RYR60HfwoJR/4YbxDXTjT1qegZryKEDRzRmsSR6+EtAHdy1iO wmhvQxsBF40keFR+UF/dfEs5gIzF4qyvUcUpvf0cKCfEVHM9ZZU/JivA0S8xLMKHF2dtmQFACtM T4MKMX49bOy64gIMUkH7zcMxsRAX2shGNlVWEenKLnAEndWkjWJi2wYdhj5+xWTVtmqRDXV6bD6 sGl9bkT+HTo2sQfV0f1y+xm6s+8hXpnPprJ9FGk8sxPPSotA1DbEql5Xn2PWSqoxtc9P4/X5ta4 kJLKZ+rkYwu+kiQ== X-Developer-Key: i=chuck.lever@oracle.com; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97 From: Chuck Lever RFC 7862 Section 4.8 states: > A copy offload stateid will be valid until either (A) the client > or server restarts or (B) the client returns the resource by > issuing an OFFLOAD_CANCEL operation or the client replies to a > CB_OFFLOAD operation. Instead of releasing async copy state when the CB_OFFLOAD callback completes, now let it live until the next laundromat run after the callback completes. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 35 ++++++++++++++++++++++++++++++++++- fs/nfsd/nfs4state.c | 1 + fs/nfsd/state.h | 1 + fs/nfsd/xdr4.h | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 4d44b785a580..7061db2f33b0 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1308,6 +1308,39 @@ bool nfsd4_has_active_async_copies(struct nfs4_client *clp) return result; } +/** + * nfsd4_async_copy_reaper - Purge completed copies + * @nn: Network namespace with possible active copy information + */ +void nfsd4_async_copy_reaper(struct nfsd_net *nn) +{ + struct nfs4_client *clp; + struct nfsd4_copy *copy; + LIST_HEAD(reaplist); + + spin_lock(&nn->client_lock); + list_for_each_entry(clp, &nn->client_lru, cl_lru) { + struct list_head *pos, *next; + + spin_lock(&clp->async_lock); + list_for_each_safe(pos, next, &clp->async_copies) { + copy = list_entry(pos, struct nfsd4_copy, copies); + if (test_bit(NFSD4_COPY_F_OFFLOAD_DONE, ©->cp_flags)) { + list_del_init(©->copies); + list_add(©->copies, &reaplist); + } + } + spin_unlock(&clp->async_lock); + } + spin_unlock(&nn->client_lock); + + while (!list_empty(&reaplist)) { + copy = list_first_entry(&reaplist, struct nfsd4_copy, copies); + list_del_init(©->copies); + cleanup_async_copy(copy); + } +} + static void nfs4_put_copy(struct nfsd4_copy *copy) { if (!refcount_dec_and_test(©->refcount)) @@ -1637,7 +1670,7 @@ static void nfsd4_cb_offload_release(struct nfsd4_callback *cb) struct nfsd4_copy *copy = container_of(cbo, struct nfsd4_copy, cp_cb_offload); - cleanup_async_copy(copy); + set_bit(NFSD4_COPY_F_OFFLOAD_DONE, ©->cp_flags); } static int nfsd4_cb_offload_done(struct nfsd4_callback *cb, diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index cde5ba69d7a5..ea2b5ab9a05c 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -6562,6 +6562,7 @@ nfs4_laundromat(struct nfsd_net *nn) _free_cpntf_state_locked(nn, cps); } spin_unlock(&nn->s2s_cp_lock); + nfsd4_async_copy_reaper(nn); nfs4_get_client_reaplist(nn, &reaplist, <); nfs4_process_client_reaplist(&reaplist); diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 6c84c0900ec4..0e7f0dd960c1 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -742,6 +742,7 @@ extern void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp, extern bool nfsd4_run_cb(struct nfsd4_callback *cb); extern void nfsd4_shutdown_callback(struct nfs4_client *); extern void nfsd4_shutdown_copy(struct nfs4_client *clp); +void nfsd4_async_copy_reaper(struct nfsd_net *nn); bool nfsd4_has_active_async_copies(struct nfs4_client *clp); extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(struct xdr_netobj name, struct xdr_netobj princhash, struct nfsd_net *nn); diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index cd2bf63651e3..a3a59fce33b5 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h @@ -694,6 +694,7 @@ struct nfsd4_copy { #define NFSD4_COPY_F_SYNCHRONOUS (2) #define NFSD4_COPY_F_COMMITTED (3) #define NFSD4_COPY_F_COMPLETED (4) +#define NFSD4_COPY_F_OFFLOAD_DONE (5) /* response */ __be32 nfserr; From patchwork Thu Oct 31 13:40:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13857938 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 A267519DF8D for ; Thu, 31 Oct 2024 13:40:17 +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=1730382017; cv=none; b=lJFksLpDuY/pLB8h/BeI93PUjJKgHf063iKLfzA8igwLoBPplgcuKfZms9uPBD/N5ZUvctRzBWl4bCyf7ozv3GQ70/wfkNQMaAh8MnGKncMh6Ie6HdLQZcnd3kB7tpSqfhzeI3cxQmP6HBnHsMLkifFKYz6NzEU51gI419QeTDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730382017; c=relaxed/simple; bh=o5uhiIfV5BQBFN70IdYLLkZwXrWuMtvfZXPk9jgNQ70=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NYq5SHERDJ2vVCEbOPNmQlVRBL82wAQGHorW3TrrGSkth/GSOSxckR3TeXGtYFrpbplwEZKy2LlZ6/PuJnyYGWIz/VKvyRVK6dI0/u/20DCrYZ+bqvl8s/87GOwzdrp6JUHCvZfSPJ2QcTF9filMkX37CzgwGfTE8xR7RxuYwVY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bDlxBGqX; 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="bDlxBGqX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDC95C4DDF1; Thu, 31 Oct 2024 13:40:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730382017; bh=o5uhiIfV5BQBFN70IdYLLkZwXrWuMtvfZXPk9jgNQ70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bDlxBGqXRvUjxRpHkDqNfJRHBWFGQ1Fl3y58ggvUJoK2WcJL0DIncfaxqjLqpuvMn 6xNrVKJljknZITFEYD6wf6MUgPhQ5jY0PPlBoWLjM9FkT+Qli7qcHojoK2XFremExX SEUOXyjOVGawMbAGJOkXel+25kZZh61b8ozupnDlkoR7xXmMBosLHMNwvJ1Jf3El5O HIepqlY9YI+jjJM7GqjSl8/BqskExxe2A/WnzLu2JgemCILloCjFKpd8JAhrLDGvJ5 dWSjAyCba2b5K9feK1WUTOdkphXW9pQbiYYRexswHHb8SbT7tlvQy5uJuVl/NcSHu/ P4DV/mxhAQjzg== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH v3 7/8] NFSD: Add nfsd4_copy time-to-live Date: Thu, 31 Oct 2024 09:40:08 -0400 Message-ID: <20241031134000.53396-17-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241031134000.53396-10-cel@kernel.org> References: <20241031134000.53396-10-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2771; i=chuck.lever@oracle.com; h=from:subject; bh=JaLuYLLN+OiyG7XtTAq4BRlYXuBG1Ryt2UrY/WaXo30=; b=owEBbQKS/ZANAwAIATNqszNvZn+XAcsmYgBnI4i3JcYc6ohSmWLs8RgHkcbKPtec7a6zf0GnN KlzkhaAI9KJAjMEAAEIAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCZyOItwAKCRAzarMzb2Z/ l2+wD/4y0sevk0dl1g4M3iEs6gjmy2aFmjM2rqbv4x2TY4FHYh6L3RCb4L6kdRZ/EzTL8RZAWIl /sWxdTRCBp5NgENxtJPNqC6ulkgeT43bJLhej7beHqolE5VsxPfPI/QjJq3DYEk/tygXWGcT3/b qk0LscLXc++x3gJ64db1ZfpPsAt9ymPt0R9J2M7xUdk2IXmxaEGje4HJGqe6VvsgcYQpMumL62T JspVXBE9ILdEQP2tThLXfbKgjnC6IYv5k+khU5HEKSFiPxXp9zQSzNt3Pa13qzA/3BCCj8y3JRC ZloySOyBeGQQ23RHCA9Ax2KYUeBNIKUuP4l3Kb+AXyPbPweY0hy5UEUFO4h7TF16eHkCASzGwqk C57UwcP0PMGiVajtryyG6nBK+qf1XOKRBZial3NQD6/Qegen9yNoCAlVBUSRQBa1eJca8uM1LFD QeS0bKYCtCErFheCY+f91WuCMvfL0IUlVpazl6eZ2u9bVgpyof2t1qZJk/OOY394MBWICSop702 aKqRAN4CkFQUjQe0vn26pUBdAn35qo9yfHCGFkuWBBEc34lmq571lyIYWnCjgAtzVjAMTSr4uvL IAXy7CyTGWW96SzkUT9k0LoBabnoYs0w8BsB9737ADSGbOSN2vmePObGndluUVrllO6yrn+halg LOEbE43NvO/BQ4A== X-Developer-Key: i=chuck.lever@oracle.com; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97 From: Chuck Lever Keep async copy state alive for a few lease cycles after the copy completes so that OFFLOAD_STATUS returns something meaningful. This means that NFSD's client shutdown processing needs to purge any of this state that happens to be waiting to die. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 7 +++++-- fs/nfsd/state.h | 15 +++++++++++++++ fs/nfsd/xdr4.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 7061db2f33b0..4c964bce6bd7 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1326,8 +1326,10 @@ void nfsd4_async_copy_reaper(struct nfsd_net *nn) list_for_each_safe(pos, next, &clp->async_copies) { copy = list_entry(pos, struct nfsd4_copy, copies); if (test_bit(NFSD4_COPY_F_OFFLOAD_DONE, ©->cp_flags)) { - list_del_init(©->copies); - list_add(©->copies, &reaplist); + if (--copy->cp_ttl) { + list_del_init(©->copies); + list_add(©->copies, &reaplist); + } } } spin_unlock(&clp->async_lock); @@ -1921,6 +1923,7 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, async_copy->cp_nn = nn; INIT_LIST_HEAD(&async_copy->copies); refcount_set(&async_copy->refcount, 1); + async_copy->cp_ttl = NFSD_COPY_INITIAL_TTL; /* Arbitrary cap on number of pending async copy operations */ if (atomic_inc_return(&nn->pending_async_copies) > (int)rqstp->rq_pool->sp_nrthreads) diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 0e7f0dd960c1..5242729e38ec 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -137,6 +137,21 @@ struct nfs4_cpntf_state { time64_t cpntf_time; /* last time stateid used */ }; +/* + * RFC 7862 Section 4.8 states: + * + * | A copy offload stateid will be valid until either (A) the client + * | or server restarts or (B) the client returns the resource by + * | issuing an OFFLOAD_CANCEL operation or the client replies to a + * | CB_OFFLOAD operation. + * + * Because a client might not reply to a CB_OFFLOAD, or a reply + * might get lost due to connection loss, NFSD purges async copy + * state after a short period to prevent it from accumulating + * over time. + */ +#define NFSD_COPY_INITIAL_TTL 10 + struct nfs4_cb_fattr { struct nfsd4_callback ncf_getattr; u32 ncf_cb_status; diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index a3a59fce33b5..9a0c6c107463 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h @@ -714,6 +714,7 @@ struct nfsd4_copy { struct list_head copies; struct task_struct *copy_task; refcount_t refcount; + unsigned int cp_ttl; struct nfsd4_ssc_umount_item *ss_nsui; struct nfs_fh c_fh; From patchwork Thu Oct 31 13:40:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13857939 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 F03B419DF8D for ; Thu, 31 Oct 2024 13:40:18 +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=1730382019; cv=none; b=iOWoADFidUSnQewmqouQsyHobG65roVyH+hno1LABDrz/DAiSyGclsDdqC5/4kqrRx5okJ1rlzjNtHycitgIxIxmpNN8CCzkbq/7pCvfFFwxg+Kzhd7TVgVrpBcf35SX/sNKVn+5K5Yp1NBvaOsxG+DxjS9TNqlwhyZVPccPGJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730382019; c=relaxed/simple; bh=KJSp9j5RDGGFFwepvlEOC9jeakqGm2ZY03FUCKtrNAk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aRPY+4SW1pcB+X9CibHYrXNAvcMn2Ap3+fiXA6HfPlbzD1ye0R0dhd93ncqZvh40OXz8r4Yge1+o+i2ZUVodT807ETp1K1zBST4c/z07q/R5Pf18UIUbWJmkdc/asqLIotJHpdRWdz+Ksg+UK0tr7tF2fB1wgI1Z7/1vF6FNd+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MBQMzw2G; 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="MBQMzw2G" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE0BFC4DDF8; Thu, 31 Oct 2024 13:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730382018; bh=KJSp9j5RDGGFFwepvlEOC9jeakqGm2ZY03FUCKtrNAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MBQMzw2GfYrXl/B6JIttycrDYG1lSIaH7slTvfNjQzJ6GWv3m0aVS5kAqW5tkMsbl fSPBbIP+dSvs7VfV2NGy4CJzP8HcB+vR8taYmsfo7ixBdFzZCvOhSTF25yZVAQr/vW 4+u78UDsM0irGMFfm7UMgBmTnrRc35aFTDiYduWylcXOgTrzK2Ducqi+B6ceZAlkoI hpXkV2BAfBxgBCVXG6+3tAjvw4JJj+Idq7HAvWspGCtcFM3iJDiDVxBzFRr0UL1bDU X/KTztibJ6ndZLF3+W2b9HPIoeBo8MMe1WmePuntlvZ1l14CxM/Jkn0CCjd1bLfWnp tVTn4TLeqc3Eg== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH v3 8/8] NFSD: Send CB_OFFLOAD on graceful shutdown Date: Thu, 31 Oct 2024 09:40:09 -0400 Message-ID: <20241031134000.53396-18-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241031134000.53396-10-cel@kernel.org> References: <20241031134000.53396-10-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1110; i=chuck.lever@oracle.com; h=from:subject; bh=gn+FRGvohSeE1eEJq1Lyjc/CidvyELBnjc094squNxU=; b=owEBbQKS/ZANAwAIATNqszNvZn+XAcsmYgBnI4i3mhqG0tF8ayYlErf/zbf/LfWd9e456qwmS viAIgFylVyJAjMEAAEIAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCZyOItwAKCRAzarMzb2Z/ l7lFEACxvE1kIqbRACGmZ/nuDLUR9zabhnd+is5NW/ciTvoHsxy95ATpKzpHbBkgQglvpR0WNFK NZK4tFJdNVitaVvLHju37S2Yyiu2eMp1CerDGthAzpPSx4YOQZ1yf1lKFtzGqQ96cxAd2+4WX0F jJ4GLMNTixApJMtltZk0eJD4SJ6VAeOQwMbAqm8ChXAjGaC14GKbQzOY8iDgYPzPllxwbNikZ8m rc2PPf07mFkeF8LOHIf/mdxbUyY/f5supL8VdMa9gxSPcX3oF1NoqBzkF+57LWujav/kmtabcic HPXqogpO0vKiikxHTjBSM6Bl/rfUA42clpy9XAKsFCSJIJiHoutCNNP/m4ox/k9JYuCwangDGM0 DDkaxODvmtFujmCQCuhnSc34gUDDO8krwbdhti7/QNpntpeFKePsqTAGYlpodVJg5cHvo8Fe6+b FI0/SssDNsRSKXDYtdwfC5xb4w6yF4GJEzJSWxmR/jgjQmnlPQ5i9Nj7T2stHwxQSdoK1a0T4S7 S3BhITOUvEVH39a8SUDL1xLkkJe2nNIN1ql3cJ7TVDAiG4U9x1CjzhONrmXA4y1FQli5nQXkB4c 6RFZaJDIDxPt5wQUFe27Aa4GlntqIwllThn1iZdHAaeCb4Vpsru89FHGssyxBV49wl4oVZ3Fbkq 7sfRKb+fs29Wmiw== X-Developer-Key: i=chuck.lever@oracle.com; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97 From: Chuck Lever If an async COPY operation happens to be running when the server is shut down, notify the requesting client that the copy has completed. Since the nfs4_client is going away, seems like this could introduce some UAFs. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 4c964bce6bd7..51b3f85f3791 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -68,6 +68,8 @@ MODULE_PARM_DESC(nfsd4_ssc_umount_timeout, #define NFSDDBG_FACILITY NFSDDBG_PROC +static void nfsd4_send_cb_offload(struct nfsd4_copy *copy); + static u32 nfsd_attrmask[] = { NFSD_WRITEABLE_ATTRS_WORD0, NFSD_WRITEABLE_ATTRS_WORD1, @@ -1381,8 +1383,10 @@ void nfsd4_shutdown_copy(struct nfs4_client *clp) { struct nfsd4_copy *copy; - while ((copy = nfsd4_get_copy(clp)) != NULL) + while ((copy = nfsd4_get_copy(clp)) != NULL) { nfsd4_stop_copy(copy); + nfsd4_send_cb_offload(copy); + } } #ifdef CONFIG_NFSD_V4_2_INTER_SSC