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