summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2017-04-10 06:52:51 -0400
committerAravinda VK <avishwan@redhat.com>2017-04-17 01:15:20 -0400
commit324509b340ebbab1e1531de9ba0a3ed6f4563753 (patch)
treedacc4510132e9f9c71da7ca3ecbb0eeb2af7bcc6
parentc09f5a28bfd14066f9b8cfca53c7a9d999f1613e (diff)
geo-rep: Remove unlink fop during rmdir
Even though it is known to be 'RMDIR', os.unlink was being tried and os.rmdir is issued upon receiving EISDIR. It's unnecessary unlink call for 'RMDIR'. Fixed the same. Change-Id: I8dbb680ee2c7f0c32b7799b1ed5351b3621cb42a BUG: 1441106 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: https://review.gluster.org/17041 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>
-rw-r--r--geo-replication/syncdaemon/resource.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
index 64be9aa1cb8..3e9058da25b 100644
--- a/geo-replication/syncdaemon/resource.py
+++ b/geo-replication/syncdaemon/resource.py
@@ -644,7 +644,7 @@ class Server(object):
st['uid'], st['gid'],
gf, st['mode'], bn, lnk)
- def entry_purge(entry, gfid):
+ def entry_purge(op, entry, gfid):
# This is an extremely racy code and needs to be fixed ASAP.
# The GFID check here is to be sure that the pargfid/bname
# to be purged is the GFID gotten from the changelog.
@@ -653,14 +653,14 @@ class Server(object):
if not matching_disk_gfid(gfid, entry):
return
- er = errno_wrap(os.unlink, [entry], [ENOENT, ESTALE, EISDIR],
- [EBUSY])
- if isinstance(er, int):
- if er == EISDIR:
- er = errno_wrap(os.rmdir, [entry], [ENOENT, ESTALE,
- ENOTEMPTY], [EBUSY])
- if er == ENOTEMPTY:
- return er
+ if op == 'UNLINK':
+ errno_wrap(os.unlink, [entry], [ENOENT, ESTALE],
+ [EBUSY])
+ elif op == 'RMDIR':
+ er = errno_wrap(os.rmdir, [entry], [ENOENT, ESTALE,
+ ENOTEMPTY], [EBUSY])
+ if er == ENOTEMPTY:
+ return er
def collect_failure(e, cmd_ret):
# We do this for failing fops on Slave
@@ -757,7 +757,7 @@ class Server(object):
if op in ['RMDIR', 'UNLINK']:
# Try once, if rmdir failed with ENOTEMPTY
# then delete recursively.
- er = entry_purge(entry, gfid)
+ er = entry_purge(op, entry, gfid)
if isinstance(er, int):
if er == ENOTEMPTY and op == 'RMDIR':
# Retry if ENOTEMPTY, ESTALE