d1681e
From 80087936cf49a08848ee054179e4044ef42cd29e Mon Sep 17 00:00:00 2001
d1681e
From: Kotresh HR <khiremat@redhat.com>
d1681e
Date: Fri, 13 Apr 2018 10:52:14 -0400
d1681e
Subject: [PATCH 239/260] geo-rep: Fix syncing of symlink
d1681e
d1681e
Problem:
d1681e
If symlink is created on master pointing
d1681e
to current directory (e.g symlink -> ".") with
d1681e
non root uid or gid, geo-rep worker crashes
d1681e
with ENOTSUP.
d1681e
d1681e
Cause:
d1681e
Geo-rep creates the symlink on slave and
d1681e
fixes the uid and gid using chown cmd.
d1681e
os.chown dereferences the symlink which is
d1681e
pointing to ".gfid" which is not supported.
d1681e
Note that geo-rep operates on aux-gfid-mount
d1681e
(e.g. "/mnt/.gfid/<gfid-of-symlink-file>").
d1681e
d1681e
Solution:
d1681e
The uid or gid change is acutally on symlink
d1681e
file. So use os.lchown, i.e, don't deference.
d1681e
d1681e
Upstream Reference
d1681e
> BUG: 1567209
d1681e
> Change-Id: I63575fc589d71f987bef1d350c030987738c78ad
d1681e
> Patch: https://review.gluster.org/19872
d1681e
d1681e
BUG: 1565399
d1681e
Change-Id: Ib4613719ac735a4e2856bc0655351f69f2467dac
d1681e
Signed-off-by: Kotresh HR <khiremat@redhat.com>
d1681e
Reviewed-on: https://code.engineering.redhat.com/gerrit/136820
d1681e
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d1681e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
d1681e
---
d1681e
 geo-replication/syncdaemon/resource.py | 2 +-
d1681e
 1 file changed, 1 insertion(+), 1 deletion(-)
d1681e
d1681e
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
d1681e
index 4b2a266..d6618c1 100644
d1681e
--- a/geo-replication/syncdaemon/resource.py
d1681e
+++ b/geo-replication/syncdaemon/resource.py
d1681e
@@ -868,7 +868,7 @@ class Server(object):
d1681e
                 # UID:0 and GID:0, and then call chown to set UID/GID
d1681e
                 if uid != 0 or gid != 0:
d1681e
                     path = os.path.join(pfx, gfid)
d1681e
-                    cmd_ret = errno_wrap(os.chown, [path, uid, gid], [ENOENT],
d1681e
+                    cmd_ret = errno_wrap(os.lchown, [path, uid, gid], [ENOENT],
d1681e
                                          [ESTALE, EINVAL])
d1681e
                     collect_failure(e, cmd_ret)
d1681e
 
d1681e
-- 
d1681e
1.8.3.1
d1681e