Skip to content

Commit 1ff4716

Browse files
Mike SnitzerAnna Schumaker
authored andcommitted
NFS: always probe for LOCALIO support asynchronously
It was reported that NFS client mounts of AWS Elastic File System (EFS) volumes is slow, this is because the AWS firewall disallows LOCALIO (because it doesn't consider the use of NFS_LOCALIO_PROGRAM valid), see: https://bugzilla.redhat.com/show_bug.cgi?id=2335129 Switch to performing the LOCALIO probe asynchronously to address the potential for the NFS LOCALIO protocol being disallowed and/or slowed by the remote server's response. While at it, fix nfs_local_probe_async() to always take/put a reference on the nfs_client that is using the LOCALIO protocol. Also, unexport the nfs_local_probe() symbol and make it private to fs/nfs/localio.c This change has the side-effect of initially issuing reads, writes and commits over the wire via SUNRPC until the LOCALIO probe completes. Suggested-by: Jeff Layton <[email protected]> # to always probe async Fixes: 76d4cb6 ("nfs: probe for LOCALIO when v4 client reconnects to server") Cc: [email protected] # 6.14+ Signed-off-by: Mike Snitzer <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 04a1526 commit 1ff4716

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

fs/nfs/client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init)
439439
spin_unlock(&nn->nfs_client_lock);
440440
new = rpc_ops->init_client(new, cl_init);
441441
if (!IS_ERR(new))
442-
nfs_local_probe(new);
442+
nfs_local_probe_async(new);
443443
return new;
444444
}
445445

fs/nfs/flexfilelayout/flexfilelayoutdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
400400
* keep ds_clp even if DS is local, so that if local IO cannot
401401
* proceed somehow, we can fall back to NFS whenever we want.
402402
*/
403-
nfs_local_probe(ds->ds_clp);
403+
nfs_local_probe_async(ds->ds_clp);
404404
max_payload =
405405
nfs_block_size(rpc_max_payload(ds->ds_clp->cl_rpcclient),
406406
NULL);

fs/nfs/internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@ extern int nfs_wait_bit_killable(struct wait_bit_key *key, int mode);
455455

456456
#if IS_ENABLED(CONFIG_NFS_LOCALIO)
457457
/* localio.c */
458-
extern void nfs_local_probe(struct nfs_client *);
459458
extern void nfs_local_probe_async(struct nfs_client *);
460459
extern void nfs_local_probe_async_work(struct work_struct *);
461460
extern struct nfsd_file *nfs_local_open_fh(struct nfs_client *,

fs/nfs/localio.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static bool nfs_server_uuid_is_local(struct nfs_client *clp)
171171
* - called after alloc_client and init_client (so cl_rpcclient exists)
172172
* - this function is idempotent, it can be called for old or new clients
173173
*/
174-
void nfs_local_probe(struct nfs_client *clp)
174+
static void nfs_local_probe(struct nfs_client *clp)
175175
{
176176
/* Disallow localio if disabled via sysfs or AUTH_SYS isn't used */
177177
if (!localio_enabled ||
@@ -191,14 +191,16 @@ void nfs_local_probe(struct nfs_client *clp)
191191
nfs_localio_enable_client(clp);
192192
nfs_uuid_end(&clp->cl_uuid);
193193
}
194-
EXPORT_SYMBOL_GPL(nfs_local_probe);
195194

196195
void nfs_local_probe_async_work(struct work_struct *work)
197196
{
198197
struct nfs_client *clp =
199198
container_of(work, struct nfs_client, cl_local_probe_work);
200199

200+
if (!refcount_inc_not_zero(&clp->cl_count))
201+
return;
201202
nfs_local_probe(clp);
203+
nfs_put_client(clp);
202204
}
203205

204206
void nfs_local_probe_async(struct nfs_client *clp)

0 commit comments

Comments
 (0)