summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/store.h
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2013-03-15 10:34:45 +0100
committerVijay Bellur <vbellur@redhat.com>2013-08-02 02:14:09 -0700
commitc95db3046c672473611d9ac0ab6cd93bd8211347 (patch)
tree072bfcd45c8c86fec44fce6bd443532c6184300f /libglusterfs/src/store.h
parent423aa0d57a031e865374d18cdcc489273317d785 (diff)
store: Add (un)locking functionality
Some configuration/cache files (like the NFS rmtab) can be stored on a GlusterFS volume and be used by multiple storage servers. This requires suitable locking for the gf_store_handle_t structure. Introduce gf_store_lock() and gf_store_unlock() for this purpose. The gf_store_locked_local() function can be used to check if the gf_store_handle_t has been locked by the current process. This change also includes an unrelated correction where a FILE* was getting leaked. Krishnan Parthasarathi identified this while reviewing the new locking functionality. Change-Id: I431b7510801841d4bad64480b4bb99d87e2ad347 BUG: 904065 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/4677 Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs/src/store.h')
-rw-r--r--libglusterfs/src/store.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/libglusterfs/src/store.h b/libglusterfs/src/store.h
index 4fe432e56..337103ff7 100644
--- a/libglusterfs/src/store.h
+++ b/libglusterfs/src/store.h
@@ -21,6 +21,7 @@ struct gf_store_handle_ {
char *path;
int fd;
FILE *read;
+ int locked; /* state of lockf() */
};
typedef struct gf_store_handle_ gf_store_handle_t;
@@ -99,4 +100,13 @@ gf_store_iter_destroy (gf_store_iter_t *iter);
char*
gf_store_strerror (gf_store_op_errno_t op_errno);
+int
+gf_store_lock (gf_store_handle_t *sh);
+
+void
+gf_store_unlock (gf_store_handle_t *sh);
+
+int
+gf_store_locked_local (gf_store_handle_t *sh);
+
#endif