summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-rebalance.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/dht/src/dht-rebalance.c')
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index bc7a5cf3077..7ccc54cd65e 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -1726,8 +1726,27 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
/* Copying posix acls to the linkto file messes up the permissions*/
dht_strip_out_acls (xattr);
+ /* Remove the linkto xattr as we don't want to overwrite the value
+ * set on the dst.
+ */
+ dict_del (xattr, conf->link_xattr_name);
+
+ /* We need to error out if this fails as having the wrong shard xattrs
+ * set on the dst could cause data corruption
+ */
+ ret = syncop_fsetxattr (to, dst_fd, xattr, 0, NULL, NULL);
+ if (ret < 0) {
+ *fop_errno = -ret;
+ gf_msg (this->name, GF_LOG_WARNING, -ret,
+ DHT_MSG_MIGRATE_FILE_FAILED,
+ "%s: failed to set xattr on %s",
+ loc->path, to->name);
+ ret = -1;
+ goto out;
+ }
+
if (xattr_rsp) {
- /* we no more require this key */
+ /* we no longer require this key */
dict_del (dict, conf->link_xattr_name);
dict_unref (xattr_rsp);
}
@@ -2028,7 +2047,9 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
xattr = NULL;
}
- ret = syncop_listxattr (from, loc, &xattr, NULL, NULL);
+ /* Set only the Posix ACLs this time */
+ ret = syncop_getxattr (from, loc, &xattr, POSIX_ACL_ACCESS_XATTR,
+ NULL, NULL);
if (ret < 0) {
gf_msg (this->name, GF_LOG_WARNING, -ret,
DHT_MSG_MIGRATE_FILE_FAILED,