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