summaryrefslogtreecommitdiff
path: root/fs/nfs
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2024-11-16 04:40:56 +0300
committerAnna Schumaker <anna.schumaker@oracle.com>2025-01-15 01:04:05 +0300
commit4ee7ba40007357a48447a8cbc667480acf9a006a (patch)
tree6533a2abb0b3f21e2fec46d672aa0962e24fdff1 /fs/nfs
parentb49f049a22227df701bfbca083d6cc859496e615 (diff)
downloadlinux-4ee7ba40007357a48447a8cbc667480acf9a006a.tar.xz
nfs_common: move localio_lock to new lock member of nfs_uuid_t
Remove cl_localio_lock from 'struct nfs_client' in favor of adding a lock to the nfs_uuid_t struct (which is embedded in each nfs_client). Push nfs_local_{enable,disable} implementation down to nfs_common. Those methods now call nfs_localio_{enable,disable}_client. This allows implementing nfs_localio_invalidate_clients in terms of nfs_localio_disable_client. Signed-off-by: Mike Snitzer <snitzer@kernel.org> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/client.c1
-rw-r--r--fs/nfs/localio.c14
2 files changed, 4 insertions, 11 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 550ca934c9cf..e83e1ce04613 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -186,7 +186,6 @@ 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);
- spin_lock_init(&clp->cl_localio_lock);
#endif /* CONFIG_NFS_LOCALIO */
clp->cl_principal = "*";
diff --git a/fs/nfs/localio.c b/fs/nfs/localio.c
index 94af5d89bb99..7191135b47a4 100644
--- a/fs/nfs/localio.c
+++ b/fs/nfs/localio.c
@@ -126,10 +126,8 @@ const struct rpc_program nfslocalio_program = {
*/
static void nfs_local_enable(struct nfs_client *clp)
{
- spin_lock(&clp->cl_localio_lock);
- set_bit(NFS_CS_LOCAL_IO, &clp->cl_flags);
trace_nfs_local_enable(clp);
- spin_unlock(&clp->cl_localio_lock);
+ nfs_localio_enable_client(clp);
}
/*
@@ -137,12 +135,8 @@ static void nfs_local_enable(struct nfs_client *clp)
*/
void nfs_local_disable(struct nfs_client *clp)
{
- spin_lock(&clp->cl_localio_lock);
- if (test_and_clear_bit(NFS_CS_LOCAL_IO, &clp->cl_flags)) {
- trace_nfs_local_disable(clp);
- nfs_localio_disable_client(&clp->cl_uuid);
- }
- spin_unlock(&clp->cl_localio_lock);
+ trace_nfs_local_disable(clp);
+ nfs_localio_disable_client(clp);
}
/*
@@ -184,7 +178,7 @@ static bool nfs_server_uuid_is_local(struct nfs_client *clp)
rpc_shutdown_client(rpcclient_localio);
/* Server is only local if it initialized required struct members */
- if (status || !clp->cl_uuid.net || !clp->cl_uuid.dom)
+ if (status || !rcu_access_pointer(clp->cl_uuid.net) || !clp->cl_uuid.dom)
return false;
return true;