From 7d6351fa2a3ade7fa55d13f79fd576e048e44a8b Mon Sep 17 00:00:00 2001 From: Shreyas Siravara Date: Fri, 12 Jun 2015 13:11:35 -0700 Subject: nfs: Authentication performance improvements When file operations are sent to the NFS server, authorized filehandles are cached using the exportid, mountid, gfid and host as the key to the cache. This meant that any file OR directory will always fail on the *first* fop to that filehandle since the cache used the gfid as part of the key to the cache. However, if an export is authorized, this effectively means that ALL subdirectories and files in the export directory are authorized per the permissions of the export. This results slow times to walking a directory structure over an NFS mount. Cherry picked from commit a9f58cd6cfc29a47af868fff29ce3133b9f9efe5) > Change-Id: Iad811ad7255b454d1712e75a637478401d40791e > BUG: 1232165 > Signed-off-by: Shreyas Siravara > Signed-off-by: Niels de Vos > Reviewed-on: http://review.gluster.org/11245 > Reviewed-by: jiffin tony Thottan > Reviewed-by: Kaleb KEITHLEY > Tested-by: Gluster Build System Change-Id: Iad811ad7255b454d1712e75a637478401d40791e BUG: 1231366 Signed-off-by: Shreyas Siravara Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/11256 Reviewed-by: jiffin tony Thottan Tested-by: Gluster Build System Reviewed-by: Kaleb KEITHLEY --- xlators/nfs/server/src/auth-cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'xlators/nfs') diff --git a/xlators/nfs/server/src/auth-cache.c b/xlators/nfs/server/src/auth-cache.c index b0cb7bf378d..67752ae6556 100644 --- a/xlators/nfs/server/src/auth-cache.c +++ b/xlators/nfs/server/src/auth-cache.c @@ -42,13 +42,13 @@ make_hashkey(struct nfs3_fh *fh, const char *host) gf_uuid_unparse (fh->gfid, gfid); gf_uuid_unparse (fh->mountid, mountid); - nbytes = strlen (exportid) + strlen (gfid) + strlen (host) - + strlen (mountid) + 5; + nbytes = strlen (exportid) + strlen (host) + + strlen (mountid) + 3; hashkey = GF_MALLOC (nbytes, gf_common_mt_char); if (!hashkey) return NULL; - snprintf (hashkey, nbytes, "%s:%s:%s:%s", exportid, gfid, + snprintf (hashkey, nbytes, "%s:%s:%s", exportid, mountid, host); return hashkey; -- cgit