7c2869
From a9c27ff4deeddf68acd37efdba9788e3119d2d92 Mon Sep 17 00:00:00 2001
7c2869
From: Kotresh HR <khiremat@redhat.com>
7c2869
Date: Tue, 3 Jul 2018 06:53:04 -0400
7c2869
Subject: [PATCH 681/685] geo-rep: Fix for EINVAL errors while syncing symlinks
7c2869
7c2869
geo-rep goes to faulty in the following scenario
7c2869
failing to proceed further. It's the workload
7c2869
involving symlink, rename and creation of non
7c2869
symlink file with same name
7c2869
7c2869
1. touch /mastermnt/file1
7c2869
2. ln -s "/mastermnt/file1" /mastermnt/symlink
7c2869
3. mv /mastermnt/symlink /mastermnt/rn_symlink
7c2869
4. mkdir /mastermnt/symlink
7c2869
7c2869
Fixed the same.
7c2869
7c2869
This is the partial logical backport of below patch which
7c2869
addresses the EINVAL errors. Note that this patch is not
7c2869
comparing gfid but the upstream patch does gfid comaprison
7c2869
and other stuff.
7c2869
7c2869
Backport of:
7c2869
  > Patch: https://review.gluster.org/#/c/18011/
7c2869
  > BUG: 1432046
7c2869
  > Signed-off-by: Kotresh HR <khiremat@redhat.com>
7c2869
  > Change-Id: Iaa12d6f99de47b18e0650e7c4eb455f23f8390f2
7c2869
  > Reviewed-by: Aravinda VK <avishwan@redhat.com>
7c2869
7c2869
BUG: 1590774
7c2869
Change-Id: Ib89a12f9c957254442117260aa26af337dcac6d4
7c2869
Signed-off-by: Kotresh HR <khiremat@redhat.com>
7c2869
Reviewed-on: https://code.engineering.redhat.com/gerrit/143031
7c2869
Reviewed-by: Aravinda Vishwanathapura Krishna Murthy <avishwan@redhat.com>
7c2869
Tested-by: RHGS Build Bot <nigelb@redhat.com>
7c2869
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
7c2869
---
7c2869
 geo-replication/syncdaemon/master.py | 9 +++++++++
7c2869
 1 file changed, 9 insertions(+)
7c2869
7c2869
diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py
7c2869
index 52537ff..b251d3a 100644
7c2869
--- a/geo-replication/syncdaemon/master.py
7c2869
+++ b/geo-replication/syncdaemon/master.py
7c2869
@@ -892,6 +892,15 @@ class GMasterChangelogMixin(GMasterCommon):
7c2869
                         entry_update()
7c2869
                         entries.append(edct(ty, stat=st, entry=en, gfid=gfid))
7c2869
                     elif ty == 'SYMLINK':
7c2869
+                        # stat the name and check whether it's still symlink
7c2869
+                        # or same named file/dir is created deleting the symlink
7c2869
+                        st1 = lstat(en)
7c2869
+                        if (isinstance(st1, int) or not
7c2869
+                            stat.S_ISLNK(st1.st_mode)):
7c2869
+                            logging.debug('file %s got purged in the interim'
7c2869
+                                          % go)
7c2869
+                            continue
7c2869
+
7c2869
                         rl = errno_wrap(os.readlink, [en], [ENOENT], [ESTALE])
7c2869
                         if isinstance(rl, int):
7c2869
                             continue
7c2869
-- 
7c2869
1.8.3.1
7c2869