From 7fd7eb571472fb1ecfacd36a70a4ab0a55349e88 Mon Sep 17 00:00:00 2001 From: Sunny Kumar Date: Tue, 19 May 2020 16:13:01 +0100 Subject: geo-rep: Fix corner case in rename on mkdir during hybrid crawl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: The issue is being hit during hybrid mode while handling rename on slave. In this special case the rename is recorded as mkdir and geo-rep process it by resolving the path form backend. While resolving the backend path during this special handling one corner case is not considered. Traceback (most recent call last):   File "/usr/libexec/glusterfs/python/syncdaemon/repce.py", line 118, in worker     res = getattr(self.obj, rmeth)(*in_data[2:])   File "/usr/libexec/glusterfs/python/syncdaemon/resource.py", line 588, in entry_ops     src_entry = get_slv_dir_path(slv_host, slv_volume, gfid)   File "/usr/libexec/glusterfs/python/syncdaemon/syncdutils.py", line 710, in get_slv_dir_path     dir_entry = os.path.join(pfx, pargfid, basename)   File "/usr/lib64/python2.7/posixpath.py", line 75, in join     if b.startswith('/'): AttributeError: 'int' object has no attribute 'startswith' In pyhthon3: Traceback (most recent call last): File "", line 1, in File "/usr/lib64/python3.8/posixpath.py", line 90, in join genericpath._check_arg_types('join', a, *p) File "/usr/lib64/python3.8/genericpath.py", line 152, in _check_arg_types raise TypeError(f'{funcname}() argument must be str, bytes, or ' TypeError: join() argument must be str, bytes, or os.PathLike object, not 'int' Backport of: >Ptach link: https://review.gluster.org/#/c/glusterfs/+/24468/ >Change-Id: I8b926899c60ad8c4ffc886d57028ba70fd21e332 >Fixes: #1250 >Signed-off-by: Sunny Kumar Change-Id: I8b926899c60ad8c4ffc886d57028ba70fd21e332 Fixes: #1250 Signed-off-by: Sunny Kumar (cherry picked from commit 27f5c8ba844e9da54fc1304df4ffe015a3bbb9bd) --- geo-replication/syncdaemon/syncdutils.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'geo-replication') diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py index b08098ef007..842bc6f5ea8 100644 --- a/geo-replication/syncdaemon/syncdutils.py +++ b/geo-replication/syncdaemon/syncdutils.py @@ -707,6 +707,8 @@ def get_slv_dir_path(slv_host, slv_volume, gfid): else: dirpath = dirpath.strip("/") pargfid = get_gfid_from_mnt(dirpath) + if isinstance(pargfid, int): + return None dir_entry = os.path.join(pfx, pargfid, basename) return dir_entry -- cgit