diff options
author | Susant Palai <spalai@redhat.com> | 2014-06-01 04:37:22 -0400 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-06-08 07:54:40 -0700 |
commit | 4e1ca1be6c26846e876d4181c9f2adea37856ded (patch) | |
tree | 00e1342802b5d4d007f29c39b2fbf283d3ea2867 /xlators/cluster | |
parent | bf5a9778c4c05ddd1f2b371abb3d5f70fedf4752 (diff) |
Rebalance: Avoid setting other component's xattrs
Problem 1:
In "gf_defrag_handle_hardlink" we used to do setxattr on internal
afr keys. Which lead to afr aborting the op saying "operation not
supported".
Solution : Sending a new xattr with only required keys.
Problem 2:
Hardlink migration tries to create linkto files for 2nd to (n-1)th
hardlink of a file on their respective hashed_subvolumes. It may so
happen that the linkto file already exists on the hashed subvolume
may be due to an earlier lookup or hashed subvolume on the older
graph is same as that on the new graph. Hence any new link call may
fail with EEXIST.
Solution: Will log the message with DEBUG level for EEXIST . Otherwise will
log with ERROR level.
Change-Id: I51f9bfc8cf5b9d8e94a9d614391662fddc0874d4
BUG: 1066798
Signed-off-by: Susant Palai <spalai@redhat.com>
Reviewed-on: http://review.gluster.org/7943
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 50c5d9d9a5d..d2afbc788db 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -141,6 +141,8 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t *xattrs, struct iatt iatt = {0,}; int32_t op_errno = 0; dht_conf_t *conf = NULL; + gf_loglevel_t loglevel = 0; + dict_t *link_xattr = NULL; GF_VALIDATE_OR_GOTO ("defrag", loc, out); GF_VALIDATE_OR_GOTO ("defrag", loc->name, out); @@ -163,6 +165,13 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t *xattrs, goto out; } + link_xattr = dict_new (); + if (!link_xattr) { + ret = -1; + errno = ENOMEM; + goto out; + } + cached_subvol = dht_subvol_get_cached (this, loc->inode); if (!cached_subvol) { gf_log (this->name, GF_LOG_ERROR, "Failed to get cached subvol" @@ -183,7 +192,7 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t *xattrs, data = dict_get (xattrs, conf->link_xattr_name); /* set linkto on cached -> hashed if not present, else link it */ if (!data) { - ret = dict_set_str (xattrs, conf->link_xattr_name, + ret = dict_set_str (link_xattr, conf->link_xattr_name, hashed_subvol->name); if (ret) { gf_log (this->name, GF_LOG_ERROR, "Failed to set " @@ -191,7 +200,7 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t *xattrs, goto out; } - ret = syncop_setxattr (cached_subvol, loc, xattrs, 0); + ret = syncop_setxattr (cached_subvol, loc, link_xattr, 0); if (ret) { gf_log (this->name, GF_LOG_ERROR, "Linkto setxattr " "failed %s -> %s (%s)", cached_subvol->name, @@ -214,7 +223,10 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t *xattrs, if (ret) { op_errno = -ret; ret = -1; - gf_log (this->name, GF_LOG_ERROR, "link of %s -> %s" + + loglevel = (op_errno == EEXIST) ? GF_LOG_DEBUG : \ + GF_LOG_ERROR; + gf_log (this->name, loglevel, "link of %s -> %s" " failed on subvol %s (%s)", loc->name, uuid_utoa(loc->gfid), hashed_subvol->name, strerror (op_errno)); @@ -238,6 +250,8 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t *xattrs, } ret = -2; out: + if (link_xattr) + dict_unref (link_xattr); return ret; } |