summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec/src
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2015-05-31 19:53:41 +0200
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-06-03 03:35:15 -0700
commit4a43df9de4bda19234cb30937228c745ba3c4684 (patch)
treefd65c9e0495d7b1da3fe2eb48588fe71996a1d35 /xlators/cluster/ec/src
parent9d74710581262a570547f1dc6bba4e1750871864 (diff)
cluster/ec: Fix incorrect check for iatt differences
Backport of http://review.gluster.org/11018 A previous patch (http://review.gluster.org/10974) introduced a bug that caused that some metadata differences could not be detected in some circumstances. This could cause that self-heal is not triggered and the file not repaired. We also need to consider all differences for lookup requests, even if there isn't any lock. Special handling of differences in lookup is already done in lookup specific code. Change-Id: I88e3678634d848a89f428a37209c31464e42cf8b BUG: 1225796 Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: http://review.gluster.org/11027 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/ec/src')
-rw-r--r--xlators/cluster/ec/src/ec-combine.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/xlators/cluster/ec/src/ec-combine.c b/xlators/cluster/ec/src/ec-combine.c
index 6395b223c36..b787d9be303 100644
--- a/xlators/cluster/ec/src/ec-combine.c
+++ b/xlators/cluster/ec/src/ec-combine.c
@@ -131,6 +131,15 @@ ec_iatt_is_trusted(ec_fop_data_t *fop, struct iatt *iatt)
fop = fop->parent;
}
+ /* Lookups are special requests always done without locks taken but they
+ * require to be able to identify differences between bricks. Special
+ * handling of these differences is already done in lookup specific code
+ * so we shouldn't ignore any difference here and consider all iatt
+ * structures as trusted. */
+ if (fop->id == GF_FOP_LOOKUP) {
+ return _gf_true;
+ }
+
/* Check if the iatt references an inode locked by the current fop */
for (i = 0; i < fop->lock_count; i++) {
ino = gfid_to_ino(fop->locks[i].lock->loc.inode->gfid);
@@ -168,15 +177,20 @@ int32_t ec_iatt_combine(ec_fop_data_t *fop, struct iatt *dst, struct iatt *src,
(dst[i].ia_size != src[i].ia_size)) ||
(st_mode_from_ia(dst[i].ia_prot, dst[i].ia_type) !=
st_mode_from_ia(src[i].ia_prot, src[i].ia_type)))) {
- if (!ec_iatt_is_trusted(fop, dst)) {
- /* If the iatt contains information from an inode that is not
- * locked, we ignore these differences and don't care which
+ if (ec_iatt_is_trusted(fop, dst)) {
+ /* If the iatt contains information from an inode that is
+ * locked, these differences are real problems, so we need to
+ * report them. Otherwise we ignore them and don't care which
* data is returned. */
- failed = _gf_false;
+ failed = _gf_true;
+ } else {
+ gf_log(fop->xl->name, GF_LOG_DEBUG,
+ "Ignoring iatt differences because inode is not "
+ "locked");
}
}
if (failed) {
- gf_log(THIS->name, GF_LOG_WARNING,
+ gf_log(fop->xl->name, GF_LOG_WARNING,
"Failed to combine iatt (inode: %lu-%lu, links: %u-%u, "
"uid: %u-%u, gid: %u-%u, rdev: %lu-%lu, size: %lu-%lu, "
"mode: %o-%o)",