From cbcf82aa58058fe05dbd9a8d8879ca0364e5df95 Mon Sep 17 00:00:00 2001 From: Rajesh Amaravathi Date: Thu, 12 Apr 2012 14:49:44 +0530 Subject: nfs/nlm: procedures for PC clients * This change introduces four NLMv4 procedures: NM_LOCK, SHARE, UNSHARE and FREE_ALL. These are used by PC clients (windows/dos) to control access to files. 1. NM_LOCK: this lock is not monitored by statd. 2. SHARE: A share reservation is a lock on the whole file that is taken whenever a file is opened on windows clients. This has ACCESS (N, R, W, RW) and DENY MODE (N, R, W, RW). ACCESS: mode of access requested by the client; DENY MODE: what the requesting client wants to deny other clients. 3. UNSHARE: remove a share reservation obtained by SHARE. Called while closing a file. 4. FREE_ALL: remove all share reservations and locks, both monitored and unmonitored, of the calling client. * lock and nm_lock use a common function with only a flag conveying whether or not to monitor a lock. * NOTES: 1. SHARE reservations are not STACK_WIND'd to subsequent xlators. These are maintained in-memory in the nfs xlator. 2. Consequently, for SHARE reservations to work effectively, all PC clients *must* mount from the same gNfs server. Not doing so will result in different servers maintaining separate SHARE reservations which will not be enforced for obvious reasons. Change-Id: Id4f22670a94ed58691a6a7f4c80aa8c11421a277 BUG: 800287 Signed-off-by: Rajesh Amaravathi Reviewed-on: http://review.gluster.com/3212 Tested-by: Gluster Build System Reviewed-by: Krishna Srinivas --- xlators/nfs/server/src/nlm4.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'xlators/nfs/server/src/nlm4.h') diff --git a/xlators/nfs/server/src/nlm4.h b/xlators/nfs/server/src/nlm4.h index db5874387f4..bcc7ae57343 100644 --- a/xlators/nfs/server/src/nlm4.h +++ b/xlators/nfs/server/src/nlm4.h @@ -60,11 +60,21 @@ typedef struct nlm_client { pid_t uniq; struct list_head nlm_clients; struct list_head fdes; + struct list_head shares; struct rpc_clnt *rpc_clnt; char *caller_name; int nsm_monitor; } nlm_client_t; +typedef struct nlm_share { + struct list_head client_list; + struct list_head inode_list; + gf_lkowner_t lkowner; + inode_t *inode; + fsh_mode mode; + fsh_access access; +} nlm_share_t; + typedef struct nlm_fde { struct list_head fde_list; fd_t *fd; -- cgit