summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2017-01-13 09:55:49 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2017-01-13 19:59:55 -0800
commitef341819eaedb703bc2f7bc1cd2e5ac855fed42b (patch)
treee6cc852758627cc068ffa5372f98da42fa2f79d1
parentb2ead317933a48ce00f3ee1460080cf4ad16ec9b (diff)
afr: Avoid resetting event_gen when brick is always down
Backport of http://review.gluster.org/#/c/16309/ Problem: __afr_set_in_flight_sb_status(), which resets event_gen to zero, is called if failed_subvols[i] is non-zero for any brick. But failed_subvols[i] is true even if the brick was down *before* the transaction started. Hence say if 1 brick is down in a replica-3, every writev that comes will trigger an inode refresh because of this resetting, as seen from the no. of FSTATs in the profile info in the BZ. Fix: Reset event gen only if the brick was previously a valid read child and the FOP failed on it the first time. Also `s/afr_inode_read_subvol_reset/afr_inode_event_gen_reset` because the function only resets event gen and not the data/metadata readable. Change-Id: I7840f7123d3b3e0404743988088ec349391ca980 BUG: 1412890 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/16387 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r--xlators/cluster/afr/src/afr-common.c24
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c6
-rw-r--r--xlators/cluster/afr/src/afr.h6
3 files changed, 17 insertions, 19 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 8a97e00..8a3b022 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -129,6 +129,7 @@ __afr_inode_ctx_get (xlator_t *this, inode_t *inode, afr_inode_ctx_t **ctx)
out:
return ret;
}
+
/*
* INODE CTX 64-bit VALUE FORMAT FOR SMALL (<= 16) SUBVOL COUNTS:
*
@@ -190,10 +191,7 @@ __afr_set_in_flight_sb_status (xlator_t *this, afr_local_t *local,
metadatamap_old = metadatamap = (val & 0x000000000000ffff);
datamap_old = datamap = (val & 0x00000000ffff0000) >> 16;
- /* Hard-code event to 0 since there is a failure and the inode
- * needs to be refreshed anyway.
- */
- event = 0;
+ event = (val & 0xffffffff00000000) >> 32;
if (txn_type == AFR_DATA_TRANSACTION)
tmp_map = datamap;
@@ -226,6 +224,8 @@ __afr_set_in_flight_sb_status (xlator_t *this, afr_local_t *local,
local->transaction.in_flight_sb = _gf_true;
metadatamap |= (1 << index);
}
+ if (metadatamap_old != metadatamap)
+ event = 0;
break;
case AFR_DATA_TRANSACTION:
@@ -235,10 +235,12 @@ __afr_set_in_flight_sb_status (xlator_t *this, afr_local_t *local,
local->transaction.in_flight_sb = _gf_true;
datamap |= (1 << index);
}
+ if (datamap_old != datamap)
+ event = 0;
break;
default:
- break;
+ break;
}
val = ((uint64_t) metadatamap) |
@@ -349,7 +351,7 @@ out:
}
int
-__afr_inode_read_subvol_reset_small (inode_t *inode, xlator_t *this)
+__afr_inode_event_gen_reset_small (inode_t *inode, xlator_t *this)
{
int ret = -1;
uint16_t datamap = 0;
@@ -450,7 +452,7 @@ out:
}
int
-__afr_inode_read_subvol_reset (inode_t *inode, xlator_t *this)
+__afr_inode_event_gen_reset (inode_t *inode, xlator_t *this)
{
afr_private_t *priv = NULL;
int ret = -1;
@@ -458,7 +460,7 @@ __afr_inode_read_subvol_reset (inode_t *inode, xlator_t *this)
priv = this->private;
if (priv->child_count <= 16)
- ret = __afr_inode_read_subvol_reset_small (inode, this);
+ ret = __afr_inode_event_gen_reset_small (inode, this);
else
ret = -1;
@@ -591,7 +593,7 @@ out:
int
-afr_inode_read_subvol_reset (inode_t *inode, xlator_t *this)
+afr_inode_event_gen_reset (inode_t *inode, xlator_t *this)
{
int ret = -1;
@@ -599,7 +601,7 @@ afr_inode_read_subvol_reset (inode_t *inode, xlator_t *this)
LOCK(&inode->lock);
{
- ret = __afr_inode_read_subvol_reset (inode, this);
+ ret = __afr_inode_event_gen_reset (inode, this);
}
UNLOCK(&inode->lock);
out:
@@ -1945,7 +1947,7 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this)
if (afr_replies_interpret (frame, this, local->inode, NULL)) {
read_subvol = afr_read_subvol_decide (local->inode,
this, &args);
- afr_inode_read_subvol_reset (local->inode, this);
+ afr_inode_event_gen_reset (local->inode, this);
goto cant_interpret;
} else {
read_subvol = afr_data_subvol_get (local->inode, this,
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index 4dc869c..811be65 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -127,12 +127,12 @@ __afr_dir_write_finalize (call_frame_t *frame, xlator_t *this)
continue;
if (local->replies[i].op_ret < 0) {
if (local->inode)
- afr_inode_read_subvol_reset (local->inode, this);
+ afr_inode_event_gen_reset (local->inode, this);
if (local->parent)
- afr_inode_read_subvol_reset (local->parent,
+ afr_inode_event_gen_reset (local->parent,
this);
if (local->parent2)
- afr_inode_read_subvol_reset (local->parent2,
+ afr_inode_event_gen_reset (local->parent2,
this);
continue;
}
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index daf193c..17ccfb2 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -831,7 +831,7 @@ afr_inode_read_subvol_set (inode_t *inode, xlator_t *this,
int event_generation);
int
-afr_inode_read_subvol_reset (inode_t *inode, xlator_t *this);
+afr_inode_event_gen_reset (inode_t *inode, xlator_t *this);
int
afr_read_subvol_select_by_policy (inode_t *inode, xlator_t *this,
@@ -855,10 +855,6 @@ afr_read_subvol_get (inode_t *inode, xlator_t *this, int *subvol_p,
afr_read_subvol_get(i, t, s, NULL, e, AFR_METADATA_TRANSACTION, a)
int
-afr_inode_ctx_reset_unreadable_subvol (inode_t *inode, xlator_t *this,
- int subvol_idx, int txn_type);
-
-int
afr_inode_refresh (call_frame_t *frame, xlator_t *this, inode_t *inode,
uuid_t gfid, afr_inode_refresh_cbk_t cbk);