diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2015-03-31 23:07:09 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-05-04 19:46:32 -0700 |
commit | c8cd488b794d7abb3d37f32a6d8d0a3b365aa46e (patch) | |
tree | 08c853a509ca346ea362ba2c77ec13a6f1b91677 /xlators/cluster/ec/src/ec-inode-read.c | |
parent | 582b252e3a418ee332cf3d4b1a415520e242b599 (diff) |
cluster/ec: Fix dictionary compare function
If both dicts are NULL then equal. If one of the dicts is NULL but the other
has only ignorable keys then also they are equal. If both dicts are non-null
then check if for each non-ignorable key, values are same or not. value_ignore
function is used to skip comparing values for the keys which must be present in
both the dictionaries but the value could be different.
geo-rep's stime xattr doesn't need to be present in list xattr but when
getxattr comes on stime xattr even if there aren't enough responses with the
xattr we should still give out an answer which is maximum of the stimes
available.
Change-Id: I8de2ceaa2db785b797f302f585d88e73b154167d
BUG: 1207712
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/10078
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
Diffstat (limited to 'xlators/cluster/ec/src/ec-inode-read.c')
-rw-r--r-- | xlators/cluster/ec/src/ec-inode-read.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c index 365ea3db0ec..f87df4016c0 100644 --- a/xlators/cluster/ec/src/ec-inode-read.c +++ b/xlators/cluster/ec/src/ec-inode-read.c @@ -234,6 +234,25 @@ void ec_wind_getxattr(ec_t * ec, ec_fop_data_t * fop, int32_t idx) &fop->loc[0], fop->str[0], fop->xdata); } +void +ec_handle_special_xattrs (ec_fop_data_t *fop) +{ + ec_cbk_data_t *cbk = NULL; + /* Stime may not be available on all the bricks, so even if some of the + * subvols succeed the operation, treat it as answer.*/ + if (fop->str[0] && + fnmatch (GF_XATTR_STIME_PATTERN, fop->str[0], 0) == 0) { + if (!fop->answer || (fop->answer->op_ret < 0)) { + list_for_each_entry (cbk, &fop->cbk_list, list) { + if (cbk->op_ret >= 0) { + fop->answer = cbk; + break; + } + } + } + } +} + int32_t ec_manager_getxattr(ec_fop_data_t * fop, int32_t state) { ec_cbk_data_t * cbk; @@ -263,6 +282,7 @@ int32_t ec_manager_getxattr(ec_fop_data_t * fop, int32_t state) return EC_STATE_PREPARE_ANSWER; case EC_STATE_PREPARE_ANSWER: + ec_handle_special_xattrs (fop); cbk = fop->answer; if (cbk != NULL) { |