Blob Blame History Raw
From 71bdc4203407f03cf82ecbca8601798c5575fc65 Mon Sep 17 00:00:00 2001
From: Aravinda VK <avishwan@redhat.com>
Date: Wed, 17 Jun 2015 15:46:01 -0400
Subject: [PATCH 163/190] geo-rep: ignore ESTALE as ENOENT

When DHT can't resolve a File it raises ESTALE, ignore ESTALE errors
same as ENOENT after retry.

Affected places:
    Xattr.lgetxattr
    os.listdir
    os.link
    Xattr.lsetxattr
    os.chmod
    os.chown
    os.utime
    os.readlink

BUG: 1222856
Change-Id: I4728eae6fc6419723bdca48809941a490c6ca2b4
Reviewed-On: http://review.gluster.org/11296
Reviewed-On: http://review.gluster.org/11430
Original-Author: Aravinda VK <avishwan@redhat.com>
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/51709
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Venky Shankar <vshankar@redhat.com>
---
 geo-replication/syncdaemon/master.py   |    4 ++--
 geo-replication/syncdaemon/resource.py |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py
index 6c96a02..37be4fc 100644
--- a/geo-replication/syncdaemon/master.py
+++ b/geo-replication/syncdaemon/master.py
@@ -18,7 +18,7 @@ import fcntl
 import string
 import errno
 import tarfile
-from errno import ENOENT, ENODATA, EEXIST, EACCES, EAGAIN
+from errno import ENOENT, ENODATA, EEXIST, EACCES, EAGAIN, ESTALE
 from threading import Condition, Lock
 from datetime import datetime
 from gconf import gconf
@@ -853,7 +853,7 @@ class GMasterChangelogMixin(GMasterCommon):
                         entry_update()
                         entries.append(edct(ty, stat=st, entry=en, gfid=gfid))
                     elif ty == 'SYMLINK':
-                        rl = errno_wrap(os.readlink, [en], [ENOENT])
+                        rl = errno_wrap(os.readlink, [en], [ENOENT], [ESTALE])
                         if isinstance(rl, int):
                             continue
                         entry_update()
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
index ba92a4a..c73347a 100644
--- a/geo-replication/syncdaemon/resource.py
+++ b/geo-replication/syncdaemon/resource.py
@@ -377,7 +377,7 @@ class Server(object):
     def gfid_mnt(cls, gfidpath):
         return errno_wrap(Xattr.lgetxattr,
                           [gfidpath, 'glusterfs.gfid.string',
-                           cls.GX_GFID_CANONICAL_LEN], [ENOENT])
+                           cls.GX_GFID_CANONICAL_LEN], [ENOENT], [ESTALE])
 
     @classmethod
     @_pathguard
@@ -647,7 +647,7 @@ class Server(object):
                 return
 
             names = []
-            names = errno_wrap(os.listdir, [path], [ENOENT])
+            names = errno_wrap(os.listdir, [path], [ENOENT], [ESTALE])
             if isinstance(names, int):
                 return
 
@@ -708,7 +708,7 @@ class Server(object):
                 else:
                     cmd_ret = errno_wrap(os.link,
                                          [slink, entry],
-                                         [ENOENT, EEXIST])
+                                         [ENOENT, EEXIST], [ESTALE])
                     collect_failure(e, cmd_ret)
             elif op == 'SYMLINK':
                 blob = entry_pack_symlink(gfid, bname, e['link'], e['stat'])
@@ -722,7 +722,7 @@ class Server(object):
                 else:
                     cmd_ret = errno_wrap(os.rename,
                                          [entry, en],
-                                         [ENOENT, EEXIST])
+                                         [ENOENT, EEXIST], [ESTALE])
                     collect_failure(e, cmd_ret)
             if blob:
                 cmd_ret = errno_wrap(Xattr.lsetxattr,
-- 
1.7.1