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