From nobody Sat Feb 7 20:47:41 2026 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B28AE1487F6 for ; Tue, 7 Oct 2025 21:25:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759872338; cv=none; b=WveXbMSFFq9StVPOdDMHQfsSGru9qgzKr3+EdewEiLez3RKYecnjGQwL1uWk6IprOtcy5XcAYhCMltQxa49gJPaPNmy0Ns2aky8CYKSOinTk/nU0aKXsVK8W+3C7yUi9d7q0M0oiJ15zGgN8NHVNgzcJ3p0CLN1BDvlsdhGqARg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759872338; c=relaxed/simple; bh=S1FEgML9qPG5AM0qstopvJ3G1GMqfZsPQL9p0u+C8Ig=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=h9YUiBp1ebSfF9OgwsBUqtWA7QHsurwdyunZTGMqHsn5vBdTilfFwmCJYBoyaUVHV9t5gEvKkQDBPOJ3/Bhykx/h6ZF9ncEXN+Gvem9q0FfRVMYis9dxd97gUK7wF1HWwrYR3o4e9gG9rYv0RwvwZx0b8l/bE0VsxN8gQ4TqPxg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=C5xn7euk; arc=none smtp.client-ip=209.85.210.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C5xn7euk" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-7b3e2a51678so200732a34.1 for ; Tue, 07 Oct 2025 14:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759872336; x=1760477136; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kUquPAxZ7RNpS7S7i2SrAQtXSPkHjUEz/KSOyJfe4qQ=; b=C5xn7eukzcwq8GdNRDdcFZSJR8b56CV1c3zSdTiTkmHFCLKxi6hJmMHKG/1wV02sDS 68j9bvXHrIvgzEsltBxTiBiaxk5Evkf6l6igFLOanMdM3KHqMwR0K6WMLs1EYx9t+B11 d2kKBjUwxMP8FGDcPWHZvj8M/87GB9SP8EW1upGkuM2cwFKon1jLStFNBls6Fkt1BUhE +bcbP0VHxL/wFzRYCrKg0jL9JaI1b85Ph+MUtpb0XwY6+1qWNZW+mugTgxyQ3mpvHVpE vcdyrWb4z+uOZRv9IzZye6RvbFQsFxTfi1bumYkzGfOYJUuHV9hUJU7IQLXwxdsZd0WN d0qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759872336; x=1760477136; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kUquPAxZ7RNpS7S7i2SrAQtXSPkHjUEz/KSOyJfe4qQ=; b=QssGOorO4DazEP5PAwUsKGRr1B6S9bt1xDuYXO1q6GPV957Pn+q0NoQBILFQJBGRm5 7VeIkyaG40+mzkT+s10mkgtGFeKijuUe/yHRQmJ5YUvVVZhIQ8aUFu/4VdzXUC3aWE8y DVYrQEaFFMGP34d/L3y2NIP/M52NWEXKqf2Sc+x5EsMJPJ9hjcaZadUQLkEmcYjQPXNQ H/Pd9V3xFey0v20vJoDq4YIprwkXTPcDWPj94ntrHwGWbRHhPm/58TCrtFbrLAXERqLN HWW41rndJor/J+TL2RJIUrLBH6JBpd7Qz/tpKbXfr9eT5aGab+flbdzXXfh2icDO7d21 1Htw== X-Forwarded-Encrypted: i=1; AJvYcCVpMOArPLjAt1DnP5lZW5FERlAz80wDnyfgRNUDvwTMEb5t25F6DbqDStSTOtSSGgKo/oGCEtl6lo0VS8Y=@vger.kernel.org X-Gm-Message-State: AOJu0YwYywXd/p4thhqg7W0H0Xw3e0ta6IIN6Aqdxa0VjYmneztiMx0g t0811wH2ONmGkiVwIKFfyBv1ZzKwnj+1OSbD+ESu22z1BoXjoxpes/44 X-Gm-Gg: ASbGncvEQvG7CL+6UutHSV5qL3sZuo9XQmCCIUQ+yL1FCKCDeQ5aiHKHT9/lXDGAKh+ sFgFKHw4rFqS+Fwc9rm4gXNQ8fBNOsSmuuz2QUvEyVSt2NTxSmvsMyUXj0bcepk9LKxxPNzYyf0 WERbzvKpiJzqeTRAabDSenNXESaLrqR0MBH8BZ2rNpYLEdEdRSg9kAJLlNA4CH55Nid89pzWQ2G JH7gGDCLaTAftLjqNrKe/y3mOsIRvWjSPb+hqguDNGkDZP8jCYQrAw2AP2KI6Fx5WYlYo0FRHzs L16ge8yNJkoy6S+2NQ5K9nTaz9+lx3GDdQyLA+cunXowm53chFp1bWEYCmpmbFGZXv4nQdkZT/x QHIkq+iQtfrJYOcHHse74oO2iqdsKhrvHOQX54nt1rwYU X-Google-Smtp-Source: AGHT+IGVpQmalLijAGU5vOAIIlvZRuDDP7hjcIQHqTx9MN+lNXCJVCuW2MsRZQXaL66/QVvXSBusuw== X-Received: by 2002:a05:6830:7188:b0:797:97d1:de29 with SMTP id 46e09a7af769-7c0dfef9314mr520698a34.13.1759872335719; Tue, 07 Oct 2025 14:25:35 -0700 (PDT) Received: from localhost.localdomain ([2601:282:4300:19e0::7bc8]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7bf439d2aadsm5134465a34.36.2025.10.07.14.25.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Oct 2025 14:25:35 -0700 (PDT) From: Joshua Watt X-Google-Original-From: Joshua Watt To: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Joshua Watt , Trond Myklebust , Anna Schumaker Subject: [PATCH] NFS4: Apply delay_retrans to async operations Date: Tue, 7 Oct 2025 15:22:58 -0600 Message-ID: <20251007212452.599683-1-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Joshua Watt The setting of delay_retrans is applied to synchronous RPC operations because the retransmit count is stored in same struct nfs4_exception that is passed each time an error is checked. However, for asynchronous operations (READ, WRITE, LOCKU, CLOSE, DELEGRETURN), a new struct nfs4_exception is made on the stack each time the task callback is invoked. This means that the retransmit count is always zero and thus delay_retrans never takes effect. Apply delay_retrans to these operations by tracking and updating their retransmit count. Change-Id: Ieb33e046c2b277cb979caa3faca7f52faf0568c9 Signed-off-by: Joshua Watt Reviewed-by: Benjamin Coddington --- fs/nfs/nfs4proc.c | 13 +++++++++++++ include/linux/nfs_xdr.h | 1 + 2 files changed, 14 insertions(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f58098417142..411776718494 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3636,6 +3636,7 @@ struct nfs4_closedata { } lr; struct nfs_fattr fattr; unsigned long timestamp; + unsigned short retrans; }; =20 static void nfs4_free_closedata(void *data) @@ -3664,6 +3665,7 @@ static void nfs4_close_done(struct rpc_task *task, vo= id *data) .state =3D state, .inode =3D calldata->inode, .stateid =3D &calldata->arg.stateid, + .retrans =3D calldata->retrans, }; =20 if (!nfs4_sequence_done(task, &calldata->res.seq_res)) @@ -3711,6 +3713,7 @@ static void nfs4_close_done(struct rpc_task *task, vo= id *data) default: task->tk_status =3D nfs4_async_handle_exception(task, server, task->tk_status, &exception); + calldata->retrans =3D exception.retrans; if (exception.retry) goto out_restart; } @@ -5593,9 +5596,11 @@ static int nfs4_read_done_cb(struct rpc_task *task, = struct nfs_pgio_header *hdr) .inode =3D hdr->inode, .state =3D hdr->args.context->state, .stateid =3D &hdr->args.stateid, + .retrans =3D hdr->retrans, }; task->tk_status =3D nfs4_async_handle_exception(task, server, task->tk_status, &exception); + hdr->retrans =3D exception.retrans; if (exception.retry) { rpc_restart_call_prepare(task); return -EAGAIN; @@ -5709,10 +5714,12 @@ static int nfs4_write_done_cb(struct rpc_task *task, .inode =3D hdr->inode, .state =3D hdr->args.context->state, .stateid =3D &hdr->args.stateid, + .retrans =3D hdr->retrans, }; task->tk_status =3D nfs4_async_handle_exception(task, NFS_SERVER(inode), task->tk_status, &exception); + hdr->retrans =3D exception.retrans; if (exception.retry) { rpc_restart_call_prepare(task); return -EAGAIN; @@ -6726,6 +6733,7 @@ struct nfs4_delegreturndata { struct nfs_fh fh; nfs4_stateid stateid; unsigned long timestamp; + unsigned short retrans; struct { struct nfs4_layoutreturn_args arg; struct nfs4_layoutreturn_res res; @@ -6746,6 +6754,7 @@ static void nfs4_delegreturn_done(struct rpc_task *ta= sk, void *calldata) .inode =3D data->inode, .stateid =3D &data->stateid, .task_is_privileged =3D data->args.seq_args.sa_privileged, + .retrans =3D data->retrans, }; =20 if (!nfs4_sequence_done(task, &data->res.seq_res)) @@ -6817,6 +6826,7 @@ static void nfs4_delegreturn_done(struct rpc_task *ta= sk, void *calldata) task->tk_status =3D nfs4_async_handle_exception(task, data->res.server, task->tk_status, &exception); + data->retrans =3D exception.retrans; if (exception.retry) goto out_restart; } @@ -7093,6 +7103,7 @@ struct nfs4_unlockdata { struct file_lock fl; struct nfs_server *server; unsigned long timestamp; + unsigned short retrans; }; =20 static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl, @@ -7147,6 +7158,7 @@ static void nfs4_locku_done(struct rpc_task *task, vo= id *data) struct nfs4_exception exception =3D { .inode =3D calldata->lsp->ls_state->inode, .stateid =3D &calldata->arg.stateid, + .retrans =3D calldata->retrans, }; =20 if (!nfs4_sequence_done(task, &calldata->res.seq_res)) @@ -7180,6 +7192,7 @@ static void nfs4_locku_done(struct rpc_task *task, vo= id *data) task->tk_status =3D nfs4_async_handle_exception(task, calldata->server, task->tk_status, &exception); + calldata->retrans =3D exception.retrans; if (exception.retry) rpc_restart_call_prepare(task); } diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index d56583572c98..31463286402f 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1659,6 +1659,7 @@ struct nfs_pgio_header { void *netfs; #endif =20 + unsigned short retrans; int pnfs_error; int error; /* merge with pnfs_error */ unsigned int good_bytes; /* boundary of good data */ --=20 2.51.0