diff options
author | N Balachandran <nbalacha@redhat.com> | 2018-01-10 14:06:12 +0530 |
---|---|---|
committer | N Balachandran <nbalacha@redhat.com> | 2018-01-10 14:21:05 +0530 |
commit | db992106c8be8a54bc0de612e7a0fe10c942c3e4 (patch) | |
tree | 7139197bc1e9a9b0734dfb77080d3f9b0c019d42 /xlators | |
parent | 19aa7d711f52c5c7e690b2ff12815e9a0f56acdb (diff) |
cluster/dht: Add migration checks to dht_(f)xattrop
The earlier backport was incorrect. Added the missing
lines of code.
The dht_(f)xattrop implementation did not implement
migration phase1/phase2 checks which could cause issues
with rebalance on sharded volumes.
This does not solve the issue where fops may reach the target
out of order.
> Change-Id: I2416fc35115e60659e35b4b717fd51f20746586c
> BUG: 1471031
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
BUG: 1515434
Change-Id: I183d52530e0220e3007e73672991cb79b44c022a
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 25 |
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, |