From aac1ec0a61d9267b6ae7a280b368dfd357b7dcdc Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Thu, 1 Jan 2015 13:15:45 +0100 Subject: nfs: add auth-cache for the MOUNT protocol Authentication cache for the new fine grained contol for the MOUNT protocol. The extended authentication (see Change-Id Ic060aac) benefits from caching the access/permission checks that are done when an NFS-client mounts an export. This auth-cache will be used by Change-Id I181e8c1. BUG: 1143880 Change-Id: I1379116572c8a4d1bf0c7ca4f826e51a79d91444 Original-author: Shreyas Siravara CC: Richard Wareing CC: Jiffin Tony Thottan Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/9363 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/nfs/server/src/auth-cache.h | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 xlators/nfs/server/src/auth-cache.h (limited to 'xlators/nfs/server/src/auth-cache.h') diff --git a/xlators/nfs/server/src/auth-cache.h b/xlators/nfs/server/src/auth-cache.h new file mode 100644 index 00000000000..5f2f03c1cb8 --- /dev/null +++ b/xlators/nfs/server/src/auth-cache.h @@ -0,0 +1,53 @@ +/* + Copyright 2014-present Facebook. All Rights Reserved + + This file is part of GlusterFS. + + Author : + Shreyas Siravara + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _AUTH_CACHE_H_ +#define _AUTH_CACHE_H_ + +#include "nfs-mem-types.h" +#include "mount3.h" +#include "exports.h" +#include "dict.h" +#include "nfs3.h" + +struct auth_cache { + dict_t *cache_dict; /* Dict holding fh -> authcache_entry */ + time_t ttl_sec; /* TTL of the auth cache in seconds */ +}; + + +/* Initializes the cache */ +struct auth_cache * +auth_cache_init (time_t ttl_sec); + +/* Inserts FH into cache */ +int +cache_nfs_fh (struct auth_cache *cache, struct nfs3_fh *fh, + const char *host_addr, struct export_item *export_item); + +/* Checks if the filehandle cached & writable */ +gf_boolean_t +is_nfs_fh_cached_and_writeable (struct auth_cache *cache, struct nfs3_fh *fh, + const char *host_addr); + +/* Checks if the filehandle is cached */ +gf_boolean_t +is_nfs_fh_cached (struct auth_cache *cache, struct nfs3_fh *fh, + const char *host_addr); + +/* Purge the cache */ +void +auth_cache_purge (struct auth_cache *cache); + +#endif /* _AUTH_CACHE_H_ */ -- cgit