Skip to content

Commit d368439

Browse files
Mike SnitzerTrond Myklebust
authored andcommitted
nfs/localio: avoid bouncing LOCALIO if nfs_client_is_local()
Previously nfs_local_probe() was made to disable and then attempt to re-enable LOCALIO (via LOCALIO protocol handshake) if/when it was called and LOCALIO already enabled. Vague memory for _why_ this was the case is that this was useful if/when a local NFS server were to be restarted with a local NFS client connected to it. But as it happens this causes an absurd amount of LOCALIO flapping which has a side-effect of too much IO being needlessly sent to NFSD (using RPC over the loopback network interface). This is the definition of "serious performance loss" (that negates the point of having LOCALIO). So remove this mis-optimization for re-enabling LOCALIO if/when an NFS server is restarted (which is an extremely rare thing to do). Will revisit testing that scenario again but in the meantime this patch restores the full benefit of LOCALIO. Signed-off-by: Mike Snitzer <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: NeilBrown <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 992203a commit d368439

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

fs/nfs/localio.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,8 @@ static void nfs_local_probe(struct nfs_client *clp)
180180
return;
181181
}
182182

183-
if (nfs_client_is_local(clp)) {
184-
/* If already enabled, disable and re-enable */
185-
nfs_localio_disable_client(clp);
186-
}
183+
if (nfs_client_is_local(clp))
184+
return;
187185

188186
if (!nfs_uuid_begin(&clp->cl_uuid))
189187
return;
@@ -244,7 +242,8 @@ __nfs_local_open_fh(struct nfs_client *clp, const struct cred *cred,
244242
case -ENOMEM:
245243
case -ENXIO:
246244
case -ENOENT:
247-
/* Revalidate localio, will disable if unsupported */
245+
/* Revalidate localio */
246+
nfs_localio_disable_client(clp);
248247
nfs_local_probe(clp);
249248
}
250249
}

0 commit comments

Comments
 (0)