d1681e
From 98bd66d16730964b2c6d14d5430e23dd16138193 Mon Sep 17 00:00:00 2001
d1681e
From: N Balachandran <nbalacha@redhat.com>
d1681e
Date: Wed, 22 Nov 2017 08:47:47 +0530
d1681e
Subject: [PATCH 081/128] cluster/dht: Don't set ACLs on linkto file
d1681e
d1681e
The trusted.SGI_ACL_FILE appears to set posix
d1681e
ACLs on the linkto file that is a target of
d1681e
file migration. This can mess up file permissions
d1681e
and cause linkto identification to fail.
d1681e
Now we remove all ACL xattrs from the results of
d1681e
the listxattr call on the source before setting them
d1681e
on the target.
d1681e
d1681e
> BUG: 1515042
d1681e
> https://review.gluster.org/#/c/18807/
d1681e
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
d1681e
d1681e
Change-Id: I56802dbaed783a16e3fb90f59f4ce849f8a4a9b4
d1681e
BUG: 1515051
d1681e
Signed-off-by: N Balachandran <nbalacha@redhat.com>
d1681e
Reviewed-on: https://code.engineering.redhat.com/gerrit/123870
d1681e
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d1681e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
d1681e
---
d1681e
 xlators/cluster/dht/src/dht-rebalance.c | 11 +++++++++++
d1681e
 1 file changed, 11 insertions(+)
d1681e
d1681e
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
d1681e
index 941e982..ae367d7 100644
d1681e
--- a/xlators/cluster/dht/src/dht-rebalance.c
d1681e
+++ b/xlators/cluster/dht/src/dht-rebalance.c
d1681e
@@ -163,6 +163,14 @@ dht_send_rebalance_event (xlator_t *this, int cmd, gf_defrag_status_t status)
d1681e
 }
d1681e
 
d1681e
 
d1681e
+static void
d1681e
+dht_strip_out_acls (dict_t *dict)
d1681e
+{
d1681e
+        if (dict) {
d1681e
+                dict_del (dict, "trusted.SGI_ACL_FILE");
d1681e
+                dict_del (dict, "POSIX_ACL_ACCESS_XATTR");
d1681e
+        }
d1681e
+}
d1681e
 
d1681e
 
d1681e
 
d1681e
@@ -1624,6 +1632,9 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
d1681e
                         loc->path, from->name);
d1681e
         }
d1681e
 
d1681e
+        /* Copying posix acls to the linkto file messes up the permissions*/
d1681e
+        dht_strip_out_acls (xattr);
d1681e
+
d1681e
         /* create the destination, with required modes/xattr */
d1681e
         ret = __dht_rebalance_create_dst_file (this, to, from, loc, &stbuf,
d1681e
                                                &dst_fd, xattr, fop_errno);
d1681e
-- 
d1681e
1.8.3.1
d1681e