From: Mike Snitzer <snitzer@kernel.org>
To: linux-nfs@vger.kernel.org
Cc: Anna Schumaker <anna@kernel.org>,
Trond Myklebust <trondmy@hammerspace.com>,
Chuck Lever <chuck.lever@oracle.com>,
Jeff Layton <jlayton@kernel.org>, NeilBrown <neilb@suse.de>
Subject: [for-6.13 PATCH v3 13/14] nfs: probe for LOCALIO when v4 client reconnects to server
Date: Fri, 15 Nov 2024 20:41:05 -0500 [thread overview]
Message-ID: <20241116014106.25456-14-snitzer@kernel.org> (raw)
In-Reply-To: <20241116014106.25456-1-snitzer@kernel.org>
Introduce nfs_local_probe_async() for the NFS client to initiate
if/when it reconnects with server. For NFSv4 it is a simple matter to
call nfs_local_probe_async() from nfs4_do_reclaim (during NFSv4
grace).
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
---
fs/nfs/client.c | 1 +
fs/nfs/internal.h | 3 +++
fs/nfs/localio.c | 14 ++++++++++++++
fs/nfs/nfs4state.c | 1 +
include/linux/nfs_fs_sb.h | 1 +
5 files changed, 20 insertions(+)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 16530c71fd152..3b0918ade53cd 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -186,6 +186,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init)
seqlock_init(&clp->cl_boot_lock);
ktime_get_real_ts64(&clp->cl_nfssvc_boot);
nfs_uuid_init(&clp->cl_uuid);
+ INIT_WORK(&clp->cl_local_probe_work, nfs_local_probe_async_work);
#endif /* CONFIG_NFS_LOCALIO */
clp->cl_principal = "*";
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index a252191b9335c..ad9c56bc977bf 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -455,6 +455,8 @@ extern int nfs_wait_bit_killable(struct wait_bit_key *key, int mode);
#if IS_ENABLED(CONFIG_NFS_LOCALIO)
/* localio.c */
extern void nfs_local_probe(struct nfs_client *);
+extern void nfs_local_probe_async(struct nfs_client *);
+extern void nfs_local_probe_async_work(struct work_struct *);
extern struct nfsd_file *nfs_local_open_fh(struct nfs_client *,
const struct cred *,
struct nfs_fh *,
@@ -471,6 +473,7 @@ extern bool nfs_server_is_local(const struct nfs_client *clp);
#else /* CONFIG_NFS_LOCALIO */
static inline void nfs_local_probe(struct nfs_client *clp) {}
+static inline void nfs_local_probe_async(struct nfs_client *clp) {}
static inline struct nfsd_file *
nfs_local_open_fh(struct nfs_client *clp, const struct cred *cred,
struct nfs_fh *fh, struct nfs_file_localio *nfl,
diff --git a/fs/nfs/localio.c b/fs/nfs/localio.c
index 4b6bf4ea7d7fc..1eee5aac28843 100644
--- a/fs/nfs/localio.c
+++ b/fs/nfs/localio.c
@@ -193,6 +193,20 @@ void nfs_local_probe(struct nfs_client *clp)
}
EXPORT_SYMBOL_GPL(nfs_local_probe);
+void nfs_local_probe_async_work(struct work_struct *work)
+{
+ struct nfs_client *clp =
+ container_of(work, struct nfs_client, cl_local_probe_work);
+
+ nfs_local_probe(clp);
+}
+
+void nfs_local_probe_async(struct nfs_client *clp)
+{
+ queue_work(nfsiod_workqueue, &clp->cl_local_probe_work);
+}
+EXPORT_SYMBOL_GPL(nfs_local_probe_async);
+
static inline struct nfsd_file *nfs_local_file_get(struct nfsd_file *nf)
{
return nfs_to->nfsd_file_get(nf);
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 9a9f60a2291b4..542cdf71229fe 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1955,6 +1955,7 @@ static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recov
}
rcu_read_unlock();
nfs4_free_state_owners(&freeme);
+ nfs_local_probe_async(clp);
if (lost_locks)
pr_warn("NFS: %s: lost %d locks\n",
clp->cl_hostname, lost_locks);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index ed66df1093e89..f00bfcee7120e 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -131,6 +131,7 @@ struct nfs_client {
struct timespec64 cl_nfssvc_boot;
seqlock_t cl_boot_lock;
nfs_uuid_t cl_uuid;
+ struct work_struct cl_local_probe_work;
#endif /* CONFIG_NFS_LOCALIO */
};
--
2.44.0
next prev parent reply other threads:[~2024-11-16 1:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-16 1:40 [for-6.13 PATCH v3 00/14] nfs/nfsd: improvements for LOCALIO Mike Snitzer
2024-11-16 1:40 ` [for-6.13 PATCH v3 01/14] nfs/localio: add direct IO enablement with sync and async IO support Mike Snitzer
2024-11-16 1:40 ` [for-6.13 PATCH v3 02/14] nfsd: add nfsd_file_{get,put} to 'nfs_to' nfsd_localio_operations Mike Snitzer
2024-11-16 1:40 ` [for-6.13 PATCH v3 03/14] nfs_common: rename functions that invalidate LOCALIO nfs_clients Mike Snitzer
2024-11-16 1:40 ` [for-6.13 PATCH v3 04/14] nfs_common: move localio_lock to new lock member of nfs_uuid_t Mike Snitzer
2024-11-16 1:40 ` [for-6.13 PATCH v3 05/14] nfs: cache all open LOCALIO nfsd_file(s) in client Mike Snitzer
2024-11-16 1:40 ` [for-6.13 PATCH v3 06/14] nfsd: update percpu_ref to manage references on nfsd_net Mike Snitzer
2024-11-16 1:40 ` [for-6.13 PATCH v3 07/14] nfsd: rename nfsd_serv_ prefixed methods and variables with nfsd_net_ Mike Snitzer
2024-11-16 1:41 ` [for-6.13 PATCH v3 08/14] nfsd: nfsd_file_acquire_local no longer returns GC'd nfsd_file Mike Snitzer
2024-11-16 1:41 ` [for-6.13 PATCH v3 09/14] nfs_common: rename nfslocalio nfs_uuid_lock to nfs_uuids_lock Mike Snitzer
2024-11-16 1:41 ` [for-6.13 PATCH v3 10/14] nfs_common: track all open nfsd_files per LOCALIO nfs_client Mike Snitzer
2024-11-16 1:41 ` [for-6.13 PATCH v3 11/14] nfs_common: add nfs_localio trace events Mike Snitzer
2024-11-16 1:41 ` [for-6.13 PATCH v3 12/14] nfs/localio: remove redundant code and simplify LOCALIO enablement Mike Snitzer
2024-11-16 1:41 ` Mike Snitzer [this message]
2024-11-16 1:41 ` [for-6.13 PATCH v3 14/14] nfs: probe for LOCALIO when v3 client reconnects to server Mike Snitzer
2024-11-22 17:26 ` [for-6.13 PATCH v3 00/14] nfs/nfsd: improvements for LOCALIO Jeff Layton
2024-11-23 2:31 ` Mike Snitzer
2024-12-18 17:31 ` Mike Snitzer
2024-12-18 20:55 ` Anna Schumaker
2024-12-18 21:05 ` Chuck Lever
2024-12-18 21:19 ` Mike Snitzer
2025-01-08 16:05 ` Mike Snitzer
2025-01-08 20:56 ` Anna Schumaker
2025-01-13 22:29 ` [PATCH v2] nfs: fix incorrect error handling in LOCALIO (was: Re: [for-6.13 PATCH v3 00/14] nfs/nfsd: improvements for LOCALIO) Mike Snitzer
2024-12-18 21:07 ` [for-6.13 PATCH v3 00/14] nfs/nfsd: improvements for LOCALIO Mike Snitzer
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=20241116014106.25456-14-snitzer@kernel.org \
--to=snitzer@kernel.org \
--cc=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=trondmy@hammerspace.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