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 <khiremat@redhat.com>
Reviewed-on: https://review.gluster.org/17015
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
This commit is contained in:
Kotresh HR 2017-04-07 06:19:30 -04:00 committed by Aravinda VK
parent 3579aaaef0
commit 9f5e59abfb
2 changed files with 7 additions and 2 deletions

View File

@ -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):

View File

@ -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.")