From 66eb5c3e4c088d6b82357648a55cfb50685b9af9 Mon Sep 17 00:00:00 2001
From: Aravinda VK <avishwan@redhat.com>
Date: Tue, 6 Sep 2016 12:02:02 +0530
Subject: [PATCH 354/361] geo-rep: Fix ESTALE/EINVAL issue during
set_{xtime,stime}
Setfattr may get ESTALE/EINVAL if a file is being unlinked.
To prevent worker crashing, added retry for these error messages.
On second retry it will get ENOENT and that error is handled by
ignoring.
mainline:
> BUG: 1373373
> Reviewed-on: http://review.gluster.org/15404
> 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: Saravanakumar Arumugam <sarumuga@redhat.com>
> Reviewed-by: Kotresh HR <khiremat@redhat.com>
(cherry picked from commit 5b87a7cd69ef7c93f605ca35d14ddb94c446e699)
BUG: 1425684
Change-Id: Ic660fa13208366d57c8d3d492bbef611475e45b7
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/101413
Tested-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
geo-replication/syncdaemon/resource.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
index 9ac5c2d..3ba5cf2 100644
--- a/geo-replication/syncdaemon/resource.py
+++ b/geo-replication/syncdaemon/resource.py
@@ -546,7 +546,19 @@ class Server(object):
[path,
'.'.join([cls.GX_NSPACE, uuid, 'stime']),
struct.pack('!II', *mark)],
- [ENOENT])
+ [ENOENT],
+ [ESTALE, EINVAL])
+
+ @classmethod
+ @_pathguard
+ def set_entry_stime(cls, path, uuid, mark):
+ """set @mark as stime for @uuid on @path"""
+ errno_wrap(Xattr.lsetxattr,
+ [path,
+ '.'.join([cls.GX_NSPACE, uuid, 'entry_stime']),
+ struct.pack('!II', *mark)],
+ [ENOENT],
+ [ESTALE, EINVAL])
@classmethod
@_pathguard
@@ -556,7 +568,8 @@ class Server(object):
[path,
'.'.join([cls.GX_NSPACE, uuid, 'xtime']),
struct.pack('!II', *mark)],
- [ENOENT])
+ [ENOENT],
+ [ESTALE, EINVAL])
@classmethod
@_pathguard
--
1.8.3.1