From 1fbffa0aa45560889e29a74c4c6ff16d526de700 Mon Sep 17 00:00:00 2001 From: Jeff Darcy Date: Tue, 4 Mar 2014 16:53:33 +0000 Subject: api: add glfs_get_volfile From the API-header description: > Sometimes it's useful e.g. for scripts to see the volfile, so that > they can parse it and find subvolumes to do things like split-brain > resolution or custom layouts. The API here was specifically intended > to make access e.g. from Python as simple as possible. > > Note that the volume must be started (not necessarily mounted) for > this to work. Change-Id: If3f55ee9611cdf4b77aa53659f0af0d21957817d Signed-off-by: Jeff Darcy Reviewed-on: http://review.gluster.org/7183 Reviewed-by: Anand Avati Tested-by: Gluster Build System --- api/src/glfs-mgmt.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'api/src/glfs-mgmt.c') diff --git a/api/src/glfs-mgmt.c b/api/src/glfs-mgmt.c index afb351da0..7f62fa259 100644 --- a/api/src/glfs-mgmt.c +++ b/api/src/glfs-mgmt.c @@ -207,6 +207,8 @@ glusterfs_oldvolfile_update (struct glfs *fs, char *volfile, ssize_t size) { int ret = -1; + pthread_mutex_lock (&fs->mutex); + fs->oldvollen = size; if (!fs->oldvolfile) { fs->oldvolfile = GF_CALLOC (1, size+1, glfs_mt_volfile_t); @@ -222,6 +224,8 @@ glusterfs_oldvolfile_update (struct glfs *fs, char *volfile, ssize_t size) ret = 0; } + pthread_mutex_unlock (&fs->mutex); + return ret; } -- cgit