path: root/utils/common.h
diff options
authorPrasanna Kumar Kalever <>2017-02-21 00:06:49 +0530
committerPrasanna Kumar Kalever <>2017-02-21 15:56:52 +0530
commitc1c22333819f744287fb78fb317ff70fa82beab8 (patch)
tree25502a424c5b23cd96595fb9c3dc490f50de78cd /utils/common.h
parentb160d10dbf9c46fec60c4fa86b03dc9d6661feb4 (diff)
lockfile: don't allow multiple instances of daemon to run
until now there is no check to defend on multiple runs of daemon within the same node. This patch takes a non blocking lock on 'gluster-blockd.lock' file, if it succeeds only then daemon is allowed to run, if there is already a lock on lock-file (taken by some other instance of gluster-blockd) we will exit. This patch also renames GB_UNIX_ADDRESS from gluster-block.socket to gluster-blockd.socket, as that makes better sense. Change-Id: I43b285f9da15d078fe3df4d231d0ef8d44272d8f Signed-off-by: Prasanna Kumar Kalever <>
Diffstat (limited to 'utils/common.h')
1 files changed, 2 insertions, 1 deletions
diff --git a/utils/common.h b/utils/common.h
index 6bb3273..c544029 100644
--- a/utils/common.h
+++ b/utils/common.h
@@ -17,7 +17,8 @@
# define GB_LOGDIR DATADIR "/log/gluster-block"
# define GB_INFODIR DATADIR "/run"
-# define GB_UNIX_ADDRESS GB_INFODIR "/gluster-block.socket"
+# define GB_LOCK_FILE GB_INFODIR "/gluster-blockd.lock"
+# define GB_UNIX_ADDRESS GB_INFODIR "/gluster-blockd.socket"
# define GB_TCP_PORT 24006
# define DAEMON_LOG_FILE GB_LOGDIR "/gluster-blockd.log"