21ab4e
From a6b18bb41ac68fe3fa9acd7e9785b07fe655c39a Mon Sep 17 00:00:00 2001
21ab4e
From: Kotresh HR <khiremat@redhat.com>
21ab4e
Date: Wed, 26 Jul 2017 08:09:31 -0400
21ab4e
Subject: [PATCH 578/587] geo-rep: Fix syncing of self healed hardlinks
21ab4e
21ab4e
Problem:
21ab4e
In a distribute replicate volume, if the hardlinks
21ab4e
are created when a subvolume is down, it gets
21ab4e
healed from other subvolume when it comes up.
21ab4e
If this subvolume becomes ACTIVE in geo-rep
21ab4e
there are chances that those hardlinks won't
21ab4e
be synced to slave.
21ab4e
21ab4e
Cause:
21ab4e
AFR can't detect hardlinks during self heal.
21ab4e
It just create those files using mknod and
21ab4e
the same is recorded in changelog. Geo-rep
21ab4e
processes these mknod and ignores it as
21ab4e
it finds gfid already on slave.
21ab4e
21ab4e
Solution:
21ab4e
Geo-rep should process the mknod as link
21ab4e
if the gfid already exists on slave.
21ab4e
21ab4e
> Change-Id: I2f721b462b38a74c60e1df261662db4b99b32057
21ab4e
> BUG: 1475308
21ab4e
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
21ab4e
> Reviewed-on: https://review.gluster.org/17880
21ab4e
> Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> Reviewed-by: Aravinda VK <avishwan@redhat.com>
21ab4e
21ab4e
Change-Id: I2f721b462b38a74c60e1df261662db4b99b32057
21ab4e
BUG: 1474380
21ab4e
Signed-off-by: Kotresh HR <khiremat@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/113790
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 geo-replication/syncdaemon/resource.py | 8 ++++++++
21ab4e
 1 file changed, 8 insertions(+)
21ab4e
21ab4e
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
21ab4e
index 55bebe1..943e3ec 100644
21ab4e
--- a/geo-replication/syncdaemon/resource.py
21ab4e
+++ b/geo-replication/syncdaemon/resource.py
21ab4e
@@ -747,6 +747,14 @@ class Server(object):
21ab4e
                 if isinstance(st, int):
21ab4e
                     blob = entry_pack_reg(
21ab4e
                         gfid, bname, e['mode'], e['uid'], e['gid'])
21ab4e
+                # Self healed hardlinks are recorded as MKNOD.
21ab4e
+                # So if the gfid already exists, it should be
21ab4e
+                # processed as hard link not mknod.
21ab4e
+                elif op in ['MKNOD']:
21ab4e
+                    cmd_ret = errno_wrap(os.link,
21ab4e
+                                         [slink, entry],
21ab4e
+                                         [ENOENT, EEXIST], [ESTALE])
21ab4e
+                    collect_failure(e, cmd_ret)
21ab4e
             elif op == 'MKDIR':
21ab4e
                 slink = os.path.join(pfx, gfid)
21ab4e
                 st = lstat(slink)
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e