File 0182-mountd-Don-t-proactively-add-export-info-when-fh-inf.patch of Package nfs-utils.33226
From 4e9613b235920c34d124bfb1a0cdfedbbeed1310 Mon Sep 17 00:00:00 2001
From: NeilBrown <neil@brown.name>
Date: Fri, 19 Feb 2021 11:41:35 +1100
Subject: [PATCH] mountd: Don't proactively add export info when fh info is
requested.
When an "nfsd.fh" request is received from the kernel, we map the
file-handle prefix to a path name and report that (as required) and then
also add "nfsd.export" information with export flags applicable to that
path.
This is not necessary and was added as a perceived optimisation.
When updating data already in the kernel, it is unlikely to help as the
kernel can be expected to ask for both details at much the same time.
With NFSv3, new information is normally added by a MOUNT rpc request, so
this is irrelevant.
With NFSv4, the kernel requests the "nfsd.export" information when
walking down from ROOT, *before* requesting the nfsd.fh information, so
this "optimisation" causes unnecessary work.
A future patch will add logging of authentication requests, and this
double-handling would result in extra unnecessary log messages.
As this "optimisation" appears to have no practical value and some
(small) cost, let's remove it.
Signed-off-by: NeilBrown <neil@brown.name>
---
utils/mountd/cache.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -61,7 +61,6 @@ enum nfsd_fsid {
* Record is terminated with newline.
*
*/
-static int cache_export_ent(char *domain, struct exportent *exp, char *p);
#define INITIAL_MANAGED_GROUPS 100
@@ -696,7 +695,7 @@ static void nfsd_fh(FILE *f)
!is_mountpoint(found->e_mountpoint[0]?
found->e_mountpoint:
found->e_path)) {
- /* Cannot export this yet
+ /* Cannot export this yet
* should log a warning, but need to rate limit
xlog(L_WARNING, "%s not exported as %d not a mountpoint",
found->e_path, found->e_mountpoint);
@@ -711,10 +710,6 @@ static void nfsd_fh(FILE *f)
goto out;
}
- if (found)
- if (cache_export_ent(dom, found, found_path) < 0)
- found = 0;
-
qword_print(f, dom);
qword_printint(f, fsidtype);
qword_printhex(f, fsid, fsidlen);