|
|
4f2874 |
commit 4017afe28d640c535109576bd149bc7e0345f075
|
|
|
4f2874 |
Author: Rajesh Ghanekar <rajesh_ghanekar@symantec.com>
|
|
|
4f2874 |
Date: Wed Aug 20 14:00:59 2014 -0400
|
|
|
4f2874 |
|
|
|
4f2874 |
nfs-utils: Allow turning off nfsv3 readdir_plus
|
|
|
4f2874 |
|
|
|
4f2874 |
One of our customer's application only needs file names, not file
|
|
|
4f2874 |
attributes. With directories having 10K+ inodes (assuming buffer cache
|
|
|
4f2874 |
has directory blocks cached having file names, but inode cache is
|
|
|
4f2874 |
limited and hence need eviction of older cached inodes), older inodes
|
|
|
4f2874 |
are evicted periodically. So if they keep on doing readdir(2) from NSF
|
|
|
4f2874 |
client on multiple directories, some directory's files are periodically
|
|
|
4f2874 |
removed from inode cache and hence new readdir(2) on same directory
|
|
|
4f2874 |
requires disk access to bring back inodes again to inode cache.
|
|
|
4f2874 |
|
|
|
4f2874 |
As READDIRPLUS request fetches attributes also, doing getattr on each
|
|
|
4f2874 |
file on server, it causes unnecessary disk accesses. If READDIRPLUS on
|
|
|
4f2874 |
NFS client is returned with -ENOTSUPP, NFS client uses READDIR request
|
|
|
4f2874 |
which just gets the names of the files in a directory, not attributes,
|
|
|
4f2874 |
hence avoiding disk accesses on server.
|
|
|
4f2874 |
|
|
|
4f2874 |
There's already a corresponding client-side mount option, but an export
|
|
|
4f2874 |
option reduces the need for configuration across multiple clients.
|
|
|
4f2874 |
|
|
|
4f2874 |
This flag affects NFSv3 only. If it turns out it's needed for NFSv4 as
|
|
|
4f2874 |
well then we may have to figure out how to extend the behavior to NFSv4,
|
|
|
4f2874 |
but it's not currently obvious how to do that.
|
|
|
4f2874 |
|
|
|
4f2874 |
Signed-off-by: Rajesh Ghanekar <rajesh_ghanekar@symantec.com>
|
|
|
4f2874 |
Signed-off-by: Steve Dickson <steved@redhat.com>
|
|
|
4f2874 |
|
|
|
4f2874 |
diff --git a/support/include/nfs/export.h b/support/include/nfs/export.h
|
|
|
4f2874 |
index 1547a87..2f59e6a 100644
|
|
|
4f2874 |
--- a/support/include/nfs/export.h
|
|
|
4f2874 |
+++ b/support/include/nfs/export.h
|
|
|
4f2874 |
@@ -17,7 +17,8 @@
|
|
|
4f2874 |
#define NFSEXP_ALLSQUASH 0x0008
|
|
|
4f2874 |
#define NFSEXP_ASYNC 0x0010
|
|
|
4f2874 |
#define NFSEXP_GATHERED_WRITES 0x0020
|
|
|
4f2874 |
-/* 40, 80, 100 unused */
|
|
|
4f2874 |
+#define NFSEXP_NOREADDIRPLUS 0x0040
|
|
|
4f2874 |
+/* 80, 100 unused */
|
|
|
4f2874 |
#define NFSEXP_NOHIDE 0x0200
|
|
|
4f2874 |
#define NFSEXP_NOSUBTREECHECK 0x0400
|
|
|
4f2874 |
#define NFSEXP_NOAUTHNLM 0x0800
|
|
|
4f2874 |
diff --git a/support/nfs/exports.c b/support/nfs/exports.c
|
|
|
4f2874 |
index 819d6c4..eb782b9 100644
|
|
|
4f2874 |
--- a/support/nfs/exports.c
|
|
|
4f2874 |
+++ b/support/nfs/exports.c
|
|
|
4f2874 |
@@ -273,6 +273,8 @@ putexportent(struct exportent *ep)
|
|
|
4f2874 |
"in" : "");
|
|
|
4f2874 |
fprintf(fp, "%sacl,", (ep->e_flags & NFSEXP_NOACL)?
|
|
|
4f2874 |
"no_" : "");
|
|
|
4f2874 |
+ if (ep->e_flags & NFSEXP_NOREADDIRPLUS)
|
|
|
4f2874 |
+ fprintf(fp, "nordirplus,");
|
|
|
4f2874 |
if (ep->e_flags & NFSEXP_FSID) {
|
|
|
4f2874 |
fprintf(fp, "fsid=%d,", ep->e_fsid);
|
|
|
4f2874 |
}
|
|
|
4f2874 |
@@ -539,6 +541,8 @@ parseopts(char *cp, struct exportent *ep, int warn, int *had_subtree_opt_ptr)
|
|
|
4f2874 |
clearflags(NFSEXP_ASYNC, active, ep);
|
|
|
4f2874 |
else if (!strcmp(opt, "async"))
|
|
|
4f2874 |
setflags(NFSEXP_ASYNC, active, ep);
|
|
|
4f2874 |
+ else if (!strcmp(opt, "nordirplus"))
|
|
|
4f2874 |
+ setflags(NFSEXP_NOREADDIRPLUS, active, ep);
|
|
|
4f2874 |
else if (!strcmp(opt, "nohide"))
|
|
|
4f2874 |
setflags(NFSEXP_NOHIDE, active, ep);
|
|
|
4f2874 |
else if (!strcmp(opt, "hide"))
|
|
|
4f2874 |
diff --git a/utils/exportfs/exports.man b/utils/exportfs/exports.man
|
|
|
4f2874 |
index e8b29df..3d974d9 100644
|
|
|
4f2874 |
--- a/utils/exportfs/exports.man
|
|
|
4f2874 |
+++ b/utils/exportfs/exports.man
|
|
|
4f2874 |
@@ -360,6 +360,11 @@ supported so the same configuration can be made to work on old and new
|
|
|
4f2874 |
kernels alike.
|
|
|
4f2874 |
|
|
|
4f2874 |
.TP
|
|
|
4f2874 |
+.IR nordirplus
|
|
|
4f2874 |
+This option will disable READDIRPLUS request handling. When set,
|
|
|
4f2874 |
+READDIRPLUS requests from NFS clients return NFS3ERR_NOTSUPP, and
|
|
|
4f2874 |
+clients fall back on READDIR. This option affects only NFSv3 clients.
|
|
|
4f2874 |
+.TP
|
|
|
4f2874 |
.IR refer= path@host[+host][:path@host[+host]]
|
|
|
4f2874 |
A client referencing the export point will be directed to choose from
|
|
|
4f2874 |
the given list an alternative location for the filesystem.
|