|
|
21ab4e |
From 0d499852b3264353e4fd8afb6c0bd700839d3fb7 Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Kotresh HR <khiremat@redhat.com>
|
|
|
21ab4e |
Date: Mon, 20 Mar 2017 05:21:59 -0400
|
|
|
21ab4e |
Subject: [PATCH 378/393] geo-rep: Retry on EBUSY
|
|
|
21ab4e |
|
|
|
21ab4e |
Do not crash on EBUSY error. Add EBUSY
|
|
|
21ab4e |
retry errno list. Crash only if the error
|
|
|
21ab4e |
persists even after max retries.
|
|
|
21ab4e |
|
|
|
21ab4e |
> BUG: 1434018
|
|
|
21ab4e |
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
|
|
|
21ab4e |
> Reviewed-on: https://review.gluster.org/16924
|
|
|
21ab4e |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> Reviewed-by: Aravinda VK <avishwan@redhat.com>
|
|
|
21ab4e |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
|
|
|
21ab4e |
Change-Id: Ia067ccc6547731f28f2a315d400705e616cbf662
|
|
|
21ab4e |
BUG: 1427870
|
|
|
21ab4e |
Signed-off-by: Kotresh HR <khiremat@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/103382
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
geo-replication/syncdaemon/resource.py | 17 +++++++++--------
|
|
|
21ab4e |
geo-replication/syncdaemon/syncdutils.py | 4 ++--
|
|
|
21ab4e |
2 files changed, 11 insertions(+), 10 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
|
|
|
21ab4e |
index e81ddfe..6397cf3 100644
|
|
|
21ab4e |
--- a/geo-replication/syncdaemon/resource.py
|
|
|
21ab4e |
+++ b/geo-replication/syncdaemon/resource.py
|
|
|
21ab4e |
@@ -618,11 +618,12 @@ class Server(object):
|
|
|
21ab4e |
if not matching_disk_gfid(gfid, entry):
|
|
|
21ab4e |
return
|
|
|
21ab4e |
|
|
|
21ab4e |
- er = errno_wrap(os.unlink, [entry], [ENOENT, ESTALE, EISDIR])
|
|
|
21ab4e |
+ er = errno_wrap(os.unlink, [entry], [ENOENT, ESTALE, EISDIR],
|
|
|
21ab4e |
+ [EBUSY])
|
|
|
21ab4e |
if isinstance(er, int):
|
|
|
21ab4e |
if er == EISDIR:
|
|
|
21ab4e |
er = errno_wrap(os.rmdir, [entry], [ENOENT, ESTALE,
|
|
|
21ab4e |
- ENOTEMPTY])
|
|
|
21ab4e |
+ ENOTEMPTY], [EBUSY])
|
|
|
21ab4e |
if er == ENOTEMPTY:
|
|
|
21ab4e |
return er
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -677,7 +678,7 @@ class Server(object):
|
|
|
21ab4e |
if not matching_disk_gfid(gfid, entry):
|
|
|
21ab4e |
return
|
|
|
21ab4e |
er = errno_wrap(os.remove, [fullname], [ENOENT, ESTALE,
|
|
|
21ab4e |
- EISDIR])
|
|
|
21ab4e |
+ EISDIR], [EBUSY])
|
|
|
21ab4e |
|
|
|
21ab4e |
if er == EISDIR:
|
|
|
21ab4e |
recursive_rmdir(gfid, entry, fullname)
|
|
|
21ab4e |
@@ -685,7 +686,7 @@ class Server(object):
|
|
|
21ab4e |
if not matching_disk_gfid(gfid, entry):
|
|
|
21ab4e |
return
|
|
|
21ab4e |
|
|
|
21ab4e |
- errno_wrap(os.rmdir, [path], [ENOENT, ESTALE])
|
|
|
21ab4e |
+ errno_wrap(os.rmdir, [path], [ENOENT, ESTALE], [EBUSY])
|
|
|
21ab4e |
|
|
|
21ab4e |
def rename_with_disk_gfid_confirmation(gfid, entry, en):
|
|
|
21ab4e |
if not matching_disk_gfid(gfid, entry):
|
|
|
21ab4e |
@@ -698,7 +699,7 @@ class Server(object):
|
|
|
21ab4e |
|
|
|
21ab4e |
cmd_ret = errno_wrap(os.rename,
|
|
|
21ab4e |
[entry, en],
|
|
|
21ab4e |
- [ENOENT, EEXIST], [ESTALE])
|
|
|
21ab4e |
+ [ENOENT, EEXIST], [ESTALE, EBUSY])
|
|
|
21ab4e |
collect_failure(e, cmd_ret)
|
|
|
21ab4e |
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -788,12 +789,12 @@ class Server(object):
|
|
|
21ab4e |
# we have a hard link, we can now unlink source
|
|
|
21ab4e |
try:
|
|
|
21ab4e |
errno_wrap(os.unlink, [entry],
|
|
|
21ab4e |
- [ENOENT, ESTALE])
|
|
|
21ab4e |
+ [ENOENT, ESTALE], [EBUSY])
|
|
|
21ab4e |
except OSError as e:
|
|
|
21ab4e |
if e.errno == EISDIR:
|
|
|
21ab4e |
try:
|
|
|
21ab4e |
errno_wrap(os.rmdir, [entry],
|
|
|
21ab4e |
- [ENOENT, ESTALE])
|
|
|
21ab4e |
+ [ENOENT, ESTALE], [EBUSY])
|
|
|
21ab4e |
except OSError as e:
|
|
|
21ab4e |
if e.errno == ENOTEMPTY:
|
|
|
21ab4e |
logging.error(
|
|
|
21ab4e |
@@ -811,7 +812,7 @@ class Server(object):
|
|
|
21ab4e |
cmd_ret = errno_wrap(Xattr.lsetxattr,
|
|
|
21ab4e |
[pg, 'glusterfs.gfid.newfile', blob],
|
|
|
21ab4e |
[EEXIST, ENOENT],
|
|
|
21ab4e |
- [ESTALE, EINVAL])
|
|
|
21ab4e |
+ [ESTALE, EINVAL, EBUSY])
|
|
|
21ab4e |
failed = collect_failure(e, cmd_ret)
|
|
|
21ab4e |
|
|
|
21ab4e |
# If directory creation is failed, return immediately before
|
|
|
21ab4e |
diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py
|
|
|
21ab4e |
index b8e1e6a..e85857f 100644
|
|
|
21ab4e |
--- a/geo-replication/syncdaemon/syncdutils.py
|
|
|
21ab4e |
+++ b/geo-replication/syncdaemon/syncdutils.py
|
|
|
21ab4e |
@@ -504,12 +504,12 @@ def errno_wrap(call, arg=[], errnos=[], retry_errnos=[]):
|
|
|
21ab4e |
# probably a screwed state, cannot do much...
|
|
|
21ab4e |
logging.warn('reached maximum retries (%s)...%s' %
|
|
|
21ab4e |
(repr(arg), ex))
|
|
|
21ab4e |
- return ex.errno
|
|
|
21ab4e |
+ raise
|
|
|
21ab4e |
time.sleep(0.250) # retry the call
|
|
|
21ab4e |
|
|
|
21ab4e |
|
|
|
21ab4e |
def lstat(e):
|
|
|
21ab4e |
- return errno_wrap(os.lstat, [e], [ENOENT], [ESTALE])
|
|
|
21ab4e |
+ return errno_wrap(os.lstat, [e], [ENOENT], [ESTALE, EBUSY])
|
|
|
21ab4e |
|
|
|
21ab4e |
class NoPurgeTimeAvailable(Exception):
|
|
|
21ab4e |
pass
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|