From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>, Neil Brown <neilb@suse.de>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: Li Lingfeng <lilingfeng3@huawei.com>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Jeff Layton <jlayton@kernel.org>
Subject: [PATCH v2 0/5] nfsd: don't allow concurrent queueing of workqueue jobs
Date: Thu, 20 Feb 2025 11:47:12 -0500 [thread overview]
Message-ID: <20250220-nfsd-callback-v2-0-6a57f46e1c3a@kernel.org> (raw)
While looking at the problem that Li Lingfeng reported [1] around
callback queueing failures, I noticed that there were potential
scenarios where the callback workqueue jobs could run concurrently with
an rpc_task. Since they touch some of the same fields, this is incorrect
at best and potentially dangerous.
This patchset adds a new mechanism for ensuring that the same
nfsd4_callback can't run concurrently with itself, regardless of where
it is in its execution. This also gives us a more sure mechanism for
handling the places where we need to take and hold a reference on an
object while the callback is running.
This should also fix the problem that Li Lingfeng reported, since
queueing the work from nfsd4_cb_release() should never fail. Note that
their earlier patch (fdf5c9413ea) should be dropped from nfsd-testing
before this will apply cleanly.
[1]: https://lore.kernel.org/linux-nfs/20250218135423.1487309-1-lilingfeng3@huawei.com/
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
Changes in v2:
- added patche to handle rpc_call_async() errors
- rename NFSD4_CALLBACK_RESTART to NFSD4_CALLBACK_REQUEUE
- add patch to replace CB_GETATTR_BUSY with NFSD4_CALLBACK_REQUEUE
- Link to v1: https://lore.kernel.org/r/20250218-nfsd-callback-v1-0-14f966967dd8@kernel.org
---
Jeff Layton (5):
nfsd: prevent callback tasks running concurrently
nfsd: eliminate cl_ra_cblist and NFSD4_CLIENT_CB_RECALL_ANY
nfsd: replace CB_GETATTR_BUSY with NFSD4_CALLBACK_RUNNING
nfsd: move cb_need_restart flag into cb_flags
nfsd: handle errors from rpc_call_async()
fs/nfsd/nfs4callback.c | 26 +++++++++++++++++---------
fs/nfsd/nfs4layouts.c | 7 ++++---
fs/nfsd/nfs4proc.c | 2 +-
fs/nfsd/nfs4state.c | 31 ++++++++++++++-----------------
fs/nfsd/state.h | 18 +++++++++++-------
fs/nfsd/trace.h | 2 +-
6 files changed, 48 insertions(+), 38 deletions(-)
---
base-commit: b7e85fd7c8964e31f8fa1cf7333b12f442b642f1
change-id: 20250218-nfsd-callback-f723b8498c78
Best regards,
--
Jeff Layton <jlayton@kernel.org>
next reply other threads:[~2025-02-20 16:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 16:47 Jeff Layton [this message]
2025-02-20 16:47 ` [PATCH v2 1/5] nfsd: prevent callback tasks running concurrently Jeff Layton
2025-06-10 8:49 ` ChenXiaoSong
2025-06-10 11:09 ` Jeff Layton
2025-06-11 7:12 ` ChenXiaoSong
2025-06-16 7:49 ` ChenXiaoSong
2025-06-16 12:09 ` Jeff Layton
2025-06-16 12:18 ` ChenXiaoSong
2025-02-20 16:47 ` [PATCH v2 2/5] nfsd: eliminate cl_ra_cblist and NFSD4_CLIENT_CB_RECALL_ANY Jeff Layton
2025-02-20 16:47 ` [PATCH v2 3/5] nfsd: replace CB_GETATTR_BUSY with NFSD4_CALLBACK_RUNNING Jeff Layton
2025-02-20 16:47 ` [PATCH v2 4/5] nfsd: move cb_need_restart flag into cb_flags Jeff Layton
2025-02-20 16:47 ` [PATCH v2 5/5] nfsd: handle errors from rpc_call_async() Jeff Layton
2025-02-20 19:21 ` [PATCH v2 0/5] nfsd: don't allow concurrent queueing of workqueue jobs cel
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=20250220-nfsd-callback-v2-0-6a57f46e1c3a@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=lilingfeng3@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).