From c1c22333819f744287fb78fb317ff70fa82beab8 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Tue, 21 Feb 2017 00:06:49 +0530 Subject: 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 --- utils/common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'utils') 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" -- cgit