geo-rep : fix rename sync on hybrid crawl

Problem: When geo-rep is configured as hybrid crawl
         directory renames are not synced to the slave.

Solution: Rename sync of directory was failing due to incorrect
          destination path calculation.
          During check for existence on slave we miscalculated
          realpath. <host:brickpath/dir>.

Change-Id: I23f1ea60e86a917598fe869d5d24f8da654d8a0a
fixes: bz#1665826
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
This commit is contained in:
Sunny Kumar 2019-01-14 11:48:55 +05:30 committed by Kotresh HR
parent 0301a66bda
commit 11cf73bc41
2 changed files with 11 additions and 13 deletions
geo-replication/syncdaemon

@ -579,6 +579,8 @@ class Server(object):
logging.info(lf("Special case: rename on mkdir",
gfid=gfid, entry=repr(entry)))
src_entry = get_slv_dir_path(slv_host, slv_volume, gfid)
if src_entry is None:
collect_failure(e, ENOENT, uid, gid)
if src_entry is not None and src_entry != entry:
slv_entry_info = {}
slv_entry_info['gfid_mismatch'] = False

@ -683,19 +683,15 @@ def get_slv_dir_path(slv_host, slv_volume, gfid):
gfid[2:4],
gfid], [ENOENT], [ESTALE])
if dir_path != ENOENT:
break
if not isinstance(dir_path, int):
realpath = errno_wrap(os.readlink, [dir_path],
[ENOENT], [ESTALE])
if not isinstance(realpath, int):
realpath_parts = realpath.split('/')
pargfid = realpath_parts[-2]
basename = realpath_parts[-1]
pfx = gauxpfx()
dir_entry = os.path.join(pfx, pargfid, basename)
return dir_entry
realpath = errno_wrap(os.readlink, [dir_path],
[ENOENT], [ESTALE])
if not isinstance(realpath, int):
realpath_parts = realpath.split('/')
pargfid = realpath_parts[-2]
basename = realpath_parts[-1]
pfx = gauxpfx()
dir_entry = os.path.join(pfx, pargfid, basename)
return dir_entry
return None