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