diff options
author | Kotresh HR <khiremat@redhat.com> | 2017-03-20 05:21:59 -0400 |
---|---|---|
committer | Aravinda VK <avishwan@redhat.com> | 2017-04-07 02:08:31 -0400 |
commit | cbcb1d33de8c4bd7250a5c038e8f95456772add1 (patch) | |
tree | 2c1712cfcec01c60e24501df02d154793e5bc9a8 | |
parent | c932c0df4b70abaa85354e56efe6f1ce88ce4a38 (diff) |
geo-rep: Retry on EBUSY
Do not crash on EBUSY error. Add EBUSY
retry errno list. Crash only if the error
persists even after max retries.
Change-Id: Ia067ccc6547731f28f2a315d400705e616cbf662
BUG: 1434018
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: https://review.gluster.org/16924
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r-- | geo-replication/syncdaemon/resource.py | 17 | ||||
-rw-r--r-- | geo-replication/syncdaemon/syncdutils.py | 4 |
2 files changed, 11 insertions, 10 deletions
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index 306742e53fc..0e718b28344 100644 --- a/geo-replication/syncdaemon/resource.py +++ b/geo-replication/syncdaemon/resource.py @@ -653,11 +653,12 @@ class Server(object): if not matching_disk_gfid(gfid, entry): return - er = errno_wrap(os.unlink, [entry], [ENOENT, ESTALE, EISDIR]) + 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]) + ENOTEMPTY], [EBUSY]) if er == ENOTEMPTY: return er @@ -712,7 +713,7 @@ class Server(object): if not matching_disk_gfid(gfid, entry): return er = errno_wrap(os.remove, [fullname], [ENOENT, ESTALE, - EISDIR]) + EISDIR], [EBUSY]) if er == EISDIR: recursive_rmdir(gfid, entry, fullname) @@ -720,7 +721,7 @@ class Server(object): if not matching_disk_gfid(gfid, entry): return - errno_wrap(os.rmdir, [path], [ENOENT, ESTALE]) + errno_wrap(os.rmdir, [path], [ENOENT, ESTALE], [EBUSY]) def rename_with_disk_gfid_confirmation(gfid, entry, en): if not matching_disk_gfid(gfid, entry): @@ -733,7 +734,7 @@ class Server(object): cmd_ret = errno_wrap(os.rename, [entry, en], - [ENOENT, EEXIST], [ESTALE]) + [ENOENT, EEXIST], [ESTALE, EBUSY]) collect_failure(e, cmd_ret) @@ -823,12 +824,12 @@ class Server(object): # we have a hard link, we can now unlink source try: errno_wrap(os.unlink, [entry], - [ENOENT, ESTALE]) + [ENOENT, ESTALE], [EBUSY]) except OSError as e: if e.errno == EISDIR: try: errno_wrap(os.rmdir, [entry], - [ENOENT, ESTALE]) + [ENOENT, ESTALE], [EBUSY]) except OSError as e: if e.errno == ENOTEMPTY: logging.error( @@ -846,7 +847,7 @@ class Server(object): cmd_ret = errno_wrap(Xattr.lsetxattr, [pg, 'glusterfs.gfid.newfile', blob], [EEXIST, ENOENT], - [ESTALE, EINVAL]) + [ESTALE, EINVAL, EBUSY]) failed = collect_failure(e, cmd_ret) # If directory creation is failed, return immediately before diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py index 4d981f9fe53..225ce2c0db5 100644 --- a/geo-replication/syncdaemon/syncdutils.py +++ b/geo-replication/syncdaemon/syncdutils.py @@ -492,12 +492,12 @@ def errno_wrap(call, arg=[], errnos=[], retry_errnos=[]): # probably a screwed state, cannot do much... logging.warn('reached maximum retries (%s)...%s' % (repr(arg), ex)) - return ex.errno + raise time.sleep(0.250) # retry the call def lstat(e): - return errno_wrap(os.lstat, [e], [ENOENT], [ESTALE]) + return errno_wrap(os.lstat, [e], [ENOENT], [ESTALE, EBUSY]) class NoStimeAvailable(Exception): |