diff options
author | Nithya Balachandran <nbalacha@redhat.com> | 2015-08-27 13:10:18 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-08-31 00:27:40 -0700 |
commit | b9c730f3960efd454c8363ee39dc144e4c0dc835 (patch) | |
tree | e8e1895e404f8e47da964d56f2126daefe143885 /xlators/cluster/dht/src/dht-rebalance.c | |
parent | beb7abe8762ad73de104f0707949a09af847464d (diff) |
cluster/dht: Don't set posix acls on linkto files
Posix acls on a linkto file change the file's permission
bits and cause DHT to treat it as a non-linkto file.This
happens on the migration failure of a file on which posix
acls were set.
The fix prevents posix acls from being set on a linkto
file and copies them across only after a file has
been successfully migrated.
Change-Id: Iccf7ff6fba49fe05d691d9b83bf76a240848b212
BUG: 1247563
Signed-off-by: Nithya Balachandran <nbalacha@redhat.com>
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: http://review.gluster.org/12025
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-rebalance.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 7c91d176ff3..6b3299c4990 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -1277,6 +1277,40 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, ret = -1; } + /* Posix acls are not set on DHT linkto files as part of the initial + * initial xattrs set on the dst file, so these need + * to be set on the dst file after the linkto attrs are removed. + * TODO: Optimize this. + */ + if (xattr) { + dict_unref (xattr); + xattr = NULL; + } + + ret = syncop_listxattr (from, loc, &xattr, NULL, NULL); + if (ret < 0) { + gf_msg (this->name, GF_LOG_WARNING, 0, + DHT_MSG_MIGRATE_FILE_FAILED, + "Migrate file failed:" + "%s: failed to get xattr from %s (%s)", + loc->path, from->name, strerror (-ret)); + ret = -1; + } else { + ret = syncop_setxattr (to, loc, xattr, 0, NULL, NULL); + if (ret < 0) { + /* Potential problem here where Posix ACLs will + * not be set on the target file */ + + gf_msg (this->name, GF_LOG_WARNING, 0, + DHT_MSG_MIGRATE_FILE_FAILED, + "Migrate file failed:" + "%s: failed to set xattr on %s (%s)", + loc->path, to->name, strerror (-ret)); + ret = -1; + } + } + + /* The src file is being unlinked after this so we don't need to clean it up */ clean_src = _gf_false; |