From 4517bf8dd6de310950cc5a612955aa3a2fddb57e Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Wed, 4 Feb 2015 10:34:33 +0530 Subject: features/locks: Implement mandatory locks Initial change to fix/enable the mandatory locking support in GlusterFS as per the following design: https://review.gluster.org/#/c/12014/ Accordingly 'locks.mandatory-locking' option is available as part of this change which will accept one among the following values: * off * file * forced * optimal See design doc for more details Change-Id: I14c489b3f8af5ebcbfa155a03f0c175e9558ac46 BUG: 762184 Signed-off-by: Anoop C S Reviewed-on: http://review.gluster.org/9768 Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Poornima G Reviewed-by: Raghavendra Talur Reviewed-by: Rajesh Joseph Reviewed-by: Pranith Kumar Karampuri --- xlators/features/locks/src/locks.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'xlators/features/locks/src/locks.h') diff --git a/xlators/features/locks/src/locks.h b/xlators/features/locks/src/locks.h index 3480027c4c9..b8763091d00 100644 --- a/xlators/features/locks/src/locks.h +++ b/xlators/features/locks/src/locks.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2006-2012 Red Hat, Inc. + Copyright (c) 2006-2012, 2015-2016 Red Hat, Inc. This file is part of GlusterFS. This file is licensed to you under your choice of the GNU Lesser @@ -18,6 +18,13 @@ #include "lkowner.h" +typedef enum { + MLK_NONE, + MLK_FILE_BASED, + MLK_FORCED, + MLK_OPTIMAL +} mlk_mode_t; /* defines different mandatory locking modes*/ + struct __pl_fd; struct __posix_lock { @@ -26,6 +33,7 @@ struct __posix_lock { short fl_type; off_t fl_start; off_t fl_end; + uint32_t lk_flags; short blocked; /* waiting to acquire */ struct gf_flock user_flock; /* the flock supplied by the user */ @@ -161,7 +169,7 @@ typedef struct __pl_inode pl_inode_t; typedef struct { - gf_boolean_t mandatory; /* if mandatory locking is enabled */ + mlk_mode_t mandatory_mode; /* holds current mandatory locking mode */ gf_boolean_t trace; /* trace lock requests in and out */ char *brickname; } posix_locks_private_t; @@ -178,7 +186,7 @@ typedef struct { loc_t loc[2]; fd_t *fd; off_t offset; - enum {TRUNCATE, FTRUNCATE} op; + glusterfs_fop_t op; } pl_local_t; -- cgit