summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-04-13 01:46:01 +0000
committerAnand Avati <avati@gluster.com>2011-04-13 04:42:48 -0700
commit64161529ebe151e36c7fc86b419543b4ac02a681 (patch)
treee99e0788598bdd4dae52e7159481a2dfabea8ef2
parentc0139158ae8992513e93932d8670b5db8605ead2 (diff)
syncdaemon: fix pidfile deletion on failed pidfile acquisition
(not triggered in glusterd instrumentation of gsyncd as glusterd does pidfile probing by itself) Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 1570 (geosync related changes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570
-rw-r--r--xlators/features/marker/utils/syncdaemon/gsyncd.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/gsyncd.py b/xlators/features/marker/utils/syncdaemon/gsyncd.py
index d759f6b8d..2ce11a8aa 100644
--- a/xlators/features/marker/utils/syncdaemon/gsyncd.py
+++ b/xlators/features/marker/utils/syncdaemon/gsyncd.py
@@ -75,6 +75,8 @@ def grabfile(fname, content=None):
gconf.permanent_handles.append(f)
return f
+pid_file_owned = False
+
def grabpidfile(fname=None, setpid=True):
if not fname:
fname = gconf.pid_file
@@ -84,10 +86,13 @@ def grabpidfile(fname=None, setpid=True):
return grabfile(fname, content=content)
def startup(**kw):
+ global pid_file_owned
+
if getattr(gconf, 'pid_file', None) and kw.get('go_daemon') != 'postconn':
if not grabpidfile():
sys.stderr.write("pidfile is taken, exiting.\n")
sys.exit(2)
+ pid_file_owned = True
if kw.get('go_daemon') == 'should':
x, y = os.pipe()
@@ -125,7 +130,7 @@ def startup(**kw):
def finalize(*a):
if getattr(gconf, 'pid_file', None):
- rm_pidf = True
+ rm_pidf = pid_file_owned
if gconf.cpid:
# exit path from parent branch of daemonization
rm_pidf = False