From: Mike Snitzer <snitzer@kernel.org>
To: Trond Myklebust <trondmy@kernel.org>, Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH v2 3/3] NFSv4/pnfs: don't run the release of a LAYOUTCOMMIT in the submitter
Date: Mon, 28 Sep 2026 14:57:51 -0400 [thread overview]
Message-ID: <20260928185751.98682-4-snitzer@kernel.org> (raw)
In-Reply-To: <20260928185751.98682-1-snitzer@kernel.org>
Since commit 472e25944981 ("NFSv4.1: Pin the inode and super block in
asynchronous layoutcommit") nfs4_proc_layoutcommit() pins the inode and
the superblock for an asynchronous LAYOUTCOMMIT with
nfs_igrab_and_active(), and nfs4_layoutcommit_release() drops both with
nfs_iput_and_deactive().
The task is put with rpc_put_task(), so if it has already completed,
the release runs in the submitter. nfs4_write_inode() sends an
asynchronous LAYOUTCOMMIT from writeback, where the submitter is the
flusher. It holds sb->s_umount and has set I_SYNC on the inode, so it
can do neither the final iput() nor the final deactivate_super(). If
the task has not completed, the release runs on rpciod, because the
task has no workqueue.
Give the asynchronous task nfsiod as its workqueue and put it with
rpc_put_task_async(), as is done for WRITE and COMMIT. None of the
callers that send an asynchronous LAYOUTCOMMIT waits for its release.
A synchronous LAYOUTCOMMIT is left as it is: it pins nothing, so its
release has nothing of the kind to drop.
Fixes: 472e25944981 ("NFSv4.1: Pin the inode and super block in asynchronous layoutcommit")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
---
fs/nfs/nfs4proc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 518348e87dd8..133d01ce9f08 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -10147,6 +10147,7 @@ nfs4_proc_layoutcommit(struct nfs4_layoutcommit_data *data, bool sync)
return -EAGAIN;
}
task_setup_data.flags = RPC_TASK_ASYNC;
+ task_setup_data.workqueue = nfsiod_workqueue;
}
nfs4_init_sequence(NFS_SERVER(data->args.inode)->nfs_client,
&data->args.seq_args, &data->res.seq_res, 1, 0);
@@ -10157,7 +10158,11 @@ nfs4_proc_layoutcommit(struct nfs4_layoutcommit_data *data, bool sync)
status = task->tk_status;
trace_nfs4_layoutcommit(data->args.inode, &data->args.stateid, status);
dprintk("%s: status %d\n", __func__, status);
- rpc_put_task(task);
+ /* An asynchronous caller may be writeback: don't run rpc_release() here */
+ if (sync)
+ rpc_put_task(task);
+ else
+ rpc_put_task_async(task);
return status;
}
--
2.52.0
prev parent reply other threads:[~2026-09-28 18:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 18:57 [PATCH v2 0/3] NFS: don't release an open context from writeback Mike Snitzer
2026-09-28 18:57 ` [PATCH v2 1/3] NFS: don't release the open context of a failed write " Mike Snitzer
2026-09-28 18:57 ` [PATCH v2 2/3] NFS: don't run the release of a WRITE or COMMIT in the submitter Mike Snitzer
2026-09-28 18:57 ` Mike Snitzer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260928185751.98682-4-snitzer@kernel.org \
--to=snitzer@kernel.org \
--cc=anna@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.