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