diff options
Diffstat (limited to 'gluster/swift/common/fs_utils.py')
-rw-r--r-- | gluster/swift/common/fs_utils.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gluster/swift/common/fs_utils.py b/gluster/swift/common/fs_utils.py index 9f698df..e0fa7ce 100644 --- a/gluster/swift/common/fs_utils.py +++ b/gluster/swift/common/fs_utils.py @@ -162,7 +162,7 @@ def dir_empty(path): files = do_listdir(path) return not files except GlusterFileSystemOSError as err: - if err.errno == errno.ENOENT: + if err.errno in (errno.ENOENT, errno.ESTALE): raise FileOrDirNotFoundError() if err.errno == errno.ENOTDIR: raise NotDirectoryError() @@ -210,7 +210,7 @@ def do_stat(path): serr = err sleep(random.uniform(0.001, 0.005)) continue - if err.errno == errno.ENOENT: + if err.errno in (errno.ENOENT, errno.ESTALE): stats = None else: raise GlusterFileSystemOSError( @@ -268,10 +268,10 @@ def do_unlink(path, log=True): try: os.unlink(path) except OSError as err: - if err.errno != errno.ENOENT: + if err.errno not in (errno.ENOENT, errno.ESTALE): raise GlusterFileSystemOSError( err.errno, '%s, os.unlink("%s")' % (err.strerror, path)) - elif log: + else: logging.warn("fs_utils: os.unlink failed on non-existent path: %s", path) |