summaryrefslogtreecommitdiffstats
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-02 19:46:35 -0700
commit29d5bd5fc8a7b24865801de9f2e3f10d55af6e85 (patch)
treec40b8c4d61dde4dfed4509e0a331b9863b1822d1
parent3a94f4c52b56f08c326d3212ca5708e8daf8585b (diff)
cluster/ec: Fix incorrect check for iatt differences
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: I3766b0f412b3201ae8a04664349578713572edc6 BUG: 1225793 Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: http://review.gluster.org/11018 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
-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 a8cfabc011e..3fc8ab5c015 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)",