d2787b
From 11d648660b8bd246756f87b2f40c72fbabf084d1 Mon Sep 17 00:00:00 2001
d2787b
From: Sunny Kumar <sunkumar@redhat.com>
d2787b
Date: Tue, 19 May 2020 16:13:01 +0100
d2787b
Subject: [PATCH 498/511] geo-rep: Fix corner case in rename on mkdir during
d2787b
 hybrid crawl
d2787b
MIME-Version: 1.0
d2787b
Content-Type: text/plain; charset=UTF-8
d2787b
Content-Transfer-Encoding: 8bit
d2787b
d2787b
Problem:
d2787b
The issue is being hit during hybrid mode while handling rename on slave.
d2787b
In this special case the rename is recorded as mkdir and geo-rep process it
d2787b
by resolving the path form backend.
d2787b
d2787b
While resolving the backend path during this special handling one corner case is not considered.
d2787b
d2787b
<snip>
d2787b
Traceback (most recent call last):
d2787b
  File "/usr/libexec/glusterfs/python/syncdaemon/repce.py", line 118, in worker
d2787b
    res = getattr(self.obj, rmeth)(*in_data[2:])
d2787b
  File "/usr/libexec/glusterfs/python/syncdaemon/resource.py", line 588, in entry_ops
d2787b
    src_entry = get_slv_dir_path(slv_host, slv_volume, gfid)
d2787b
  File "/usr/libexec/glusterfs/python/syncdaemon/syncdutils.py", line 710, in get_slv_dir_path
d2787b
    dir_entry = os.path.join(pfx, pargfid, basename)
d2787b
  File "/usr/lib64/python2.7/posixpath.py", line 75, in join
d2787b
    if b.startswith('/'):
d2787b
AttributeError: 'int' object has no attribute 'startswith'
d2787b
d2787b
In pyhthon3:
d2787b
Traceback (most recent call last):
d2787b
  File "<stdin>", line 1, in <module>
d2787b
  File "/usr/lib64/python3.8/posixpath.py", line 90, in join
d2787b
    genericpath._check_arg_types('join', a, *p)
d2787b
  File "/usr/lib64/python3.8/genericpath.py", line 152, in _check_arg_types
d2787b
    raise TypeError(f'{funcname}() argument must be str, bytes, or '
d2787b
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'int'
d2787b
</snip>
d2787b
d2787b
>Change-Id: I8b926899c60ad8c4ffc886d57028ba70fd21e332
d2787b
>Fixes: #1250
d2787b
>Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
d2787b
Upstream Patch: https://review.gluster.org/c/glusterfs/+/24468/
d2787b
d2787b
BUG: 1835229
d2787b
Change-Id: I8b926899c60ad8c4ffc886d57028ba70fd21e332
d2787b
Signed-off-by: nik-redhat <nladha@redhat.com>
d2787b
Reviewed-on: https://code.engineering.redhat.com/gerrit/220867
d2787b
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d2787b
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
d2787b
---
d2787b
 geo-replication/syncdaemon/syncdutils.py | 2 ++
d2787b
 1 file changed, 2 insertions(+)
d2787b
d2787b
diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py
d2787b
index d5a94d4..26c79d0 100644
d2787b
--- a/geo-replication/syncdaemon/syncdutils.py
d2787b
+++ b/geo-replication/syncdaemon/syncdutils.py
d2787b
@@ -732,6 +732,8 @@ def get_slv_dir_path(slv_host, slv_volume, gfid):
d2787b
                     else:
d2787b
                         dirpath = dirpath.strip("/")
d2787b
                         pargfid = get_gfid_from_mnt(dirpath)
d2787b
+                        if isinstance(pargfid, int):
d2787b
+                            return None
d2787b
                     dir_entry = os.path.join(pfx, pargfid, basename)
d2787b
                     return dir_entry
d2787b
 
d2787b
-- 
d2787b
1.8.3.1
d2787b