From 9f5e59abfbf529b91d699143b0c69c8748ac6253 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Fri, 7 Apr 2017 06:19:30 -0400 Subject: geo-rep: Fix mount cleanup On corner cases, mount cleanup might cause worker crash. Fixing the same. Change-Id: I38c0af51d10673765cdb37bc5b17bb37efd043b8 BUG: 1433506 Signed-off-by: Kotresh HR Reviewed-on: https://review.gluster.org/17015 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Aravinda VK --- geo-replication/syncdaemon/resource.py | 2 +- geo-replication/syncdaemon/syncdutils.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index 3e9058da25b..2fb6d5f1cdf 100644 --- a/geo-replication/syncdaemon/resource.py +++ b/geo-replication/syncdaemon/resource.py @@ -1411,7 +1411,7 @@ class GLUSTER(AbstractUrl, SlaveLocal, SlaveRemote): def cleanup_mntpt(self, mntpt=None): if not mntpt: mntpt = self.mntpt - os.rmdir(mntpt) + errno_wrap(os.rmdir, [mntpt], [ENOENT, EBUSY]) class MountbrokerMounter(Mounter): diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py index 7385eb154b3..c6acfbb0500 100644 --- a/geo-replication/syncdaemon/syncdutils.py +++ b/geo-replication/syncdaemon/syncdutils.py @@ -241,7 +241,12 @@ def finalize(*a, **kw): p0 = subprocess.Popen (["umount", "-l", mnt], stderr=subprocess.PIPE) _, errdata = p0.communicate() if p0.returncode == 0: - os.rmdir(mnt) + try: + os.rmdir(mnt) + except OSError: + pass + else: + pass if gconf.log_exit: logging.info("exiting.") -- cgit