diff options
author | Csaba Henk <csaba@gluster.com> | 2011-04-21 08:56:09 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-04-21 09:36:46 -0700 |
commit | b5848ed21b9e718011a8f3f3870c4ed978ff17a5 (patch) | |
tree | 757ccbbde1deb954ccbfa60f37b50c5cbf972f81 | |
parent | 92e982b9d2f37ae88b22406be9ee88bf14b57197 (diff) |
syncdaemon: handle errors in glusterfs mount more carefullyv3.2.0qa15
Signed-off-by: Csaba Henk <csaba@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2826 (stale auxiliary mounts are left over)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2826
-rw-r--r-- | xlators/features/marker/utils/syncdaemon/resource.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/resource.py b/xlators/features/marker/utils/syncdaemon/resource.py index 3987b7ae909..800d297bacd 100644 --- a/xlators/features/marker/utils/syncdaemon/resource.py +++ b/xlators/features/marker/utils/syncdaemon/resource.py @@ -364,7 +364,12 @@ class GLUSTER(AbstractUrl, SlaveLocal, SlaveRemote): return True def connect(self): + def umount_l(d): + time.sleep(0.2) # XXX temporary workaround + argv = ['umount', '-l', d] + return os.spawnvp(os.P_WAIT, argv[0], argv) d = tempfile.mkdtemp(prefix='gsyncd-aux-mount-') + mounted = False try: argv = gconf.gluster_command.split() + \ (gconf.gluster_log_level and ['-L', gconf.gluster_log_level] or []) + \ @@ -372,14 +377,16 @@ class GLUSTER(AbstractUrl, SlaveLocal, SlaveRemote): '--volfile-id', self.volume, '--client-pid=-1', d] if os.spawnvp(os.P_WAIT, argv[0], argv): raise RuntimeError("command failed: " + " ".join(argv)) + mounted = True logging.debug('auxiliary glusterfs mount in place') os.chdir(d) - time.sleep(0.2) # XXX temporary workaround - argv = ['umount', '-l', d] - if os.spawnvp(os.P_WAIT, argv[0], argv): - raise RuntimeError("command failed: " + " ".join(argv)) + if umount_l(d) != 0: + raise RuntimeError("umounting %s failed" % d) + mounted = False finally: try: + if mounted: + umount_l(d) os.rmdir(d) except: logging.warn('stale mount possibly left behind on ' + d) |