|
|
cb8e9e |
From 2b70ebb3c1094a968aeadfb8185cfcaca3fdf58e Mon Sep 17 00:00:00 2001
|
|
|
cb8e9e |
From: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
cb8e9e |
Date: Sun, 7 Jun 2015 10:24:08 +0530
|
|
|
cb8e9e |
Subject: [PATCH 29/57] cluster/ec: Prevent double unwind
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Problem:
|
|
|
cb8e9e |
1) ec_access/ec_readlink_/ec_readdir[p] _cbks are trying to recover only from
|
|
|
cb8e9e |
ENOTCONN.
|
|
|
cb8e9e |
2) When the fop succeeds it unwinds right away. But when its
|
|
|
cb8e9e |
ec_fop_manager resumes, if the number of bricks that are up is less than
|
|
|
cb8e9e |
ec->fragments, the the state machine will resume with -EC_STATE_REPORT which
|
|
|
cb8e9e |
unwinds again. This will lead to crashes.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Fix:
|
|
|
cb8e9e |
- If fop fails retry on other subvols, as ESTALE/ENOENT/EBADFD etc are also
|
|
|
cb8e9e |
recoverable.
|
|
|
cb8e9e |
- unwind success/failure in _cbks
|
|
|
cb8e9e |
|
|
|
cb8e9e |
>Change-Id: I2cac3c2f9669a4e6160f1ff4abc39f0299303222
|
|
|
cb8e9e |
>BUG: 1228952
|
|
|
cb8e9e |
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
cb8e9e |
>Reviewed-on: http://review.gluster.org/11111
|
|
|
cb8e9e |
>Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
|
|
|
cb8e9e |
>Tested-by: Gluster Build System <jenkins@build.gluster.com>
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Change-Id: Ia630274a967684db4dcf0cb6b229e93d4062662f
|
|
|
cb8e9e |
BUG: 1228529
|
|
|
cb8e9e |
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
cb8e9e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/50403
|
|
|
cb8e9e |
---
|
|
|
cb8e9e |
xlators/cluster/ec/src/ec-common.c | 6 ++----
|
|
|
cb8e9e |
xlators/cluster/ec/src/ec-common.h | 3 +--
|
|
|
cb8e9e |
xlators/cluster/ec/src/ec-dir-read.c | 8 +++++---
|
|
|
cb8e9e |
xlators/cluster/ec/src/ec-inode-read.c | 8 ++++----
|
|
|
cb8e9e |
4 files changed, 12 insertions(+), 13 deletions(-)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c
|
|
|
cb8e9e |
index 062754b..46c9eec 100644
|
|
|
cb8e9e |
--- a/xlators/cluster/ec/src/ec-common.c
|
|
|
cb8e9e |
+++ b/xlators/cluster/ec/src/ec-common.c
|
|
|
cb8e9e |
@@ -535,11 +535,9 @@ void ec_dispatch_one(ec_fop_data_t * fop)
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
-int32_t ec_dispatch_one_retry(ec_fop_data_t * fop, int32_t idx, int32_t op_ret,
|
|
|
cb8e9e |
- int32_t op_errno)
|
|
|
cb8e9e |
+int32_t ec_dispatch_one_retry(ec_fop_data_t *fop, int32_t idx, int32_t op_ret)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
- if ((op_ret < 0) && (op_errno == ENOTCONN))
|
|
|
cb8e9e |
- {
|
|
|
cb8e9e |
+ if (op_ret < 0) {
|
|
|
cb8e9e |
return (ec_dispatch_next(fop, idx) >= 0);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/xlators/cluster/ec/src/ec-common.h b/xlators/cluster/ec/src/ec-common.h
|
|
|
cb8e9e |
index c0db021..e3f01ca 100644
|
|
|
cb8e9e |
--- a/xlators/cluster/ec/src/ec-common.h
|
|
|
cb8e9e |
+++ b/xlators/cluster/ec/src/ec-common.h
|
|
|
cb8e9e |
@@ -75,8 +75,7 @@ typedef enum {
|
|
|
cb8e9e |
#define EC_STATE_HEAL_POST_INODELK_UNLOCK 217
|
|
|
cb8e9e |
#define EC_STATE_HEAL_DISPATCH 218
|
|
|
cb8e9e |
|
|
|
cb8e9e |
-int32_t ec_dispatch_one_retry(ec_fop_data_t * fop, int32_t idx, int32_t op_ret,
|
|
|
cb8e9e |
- int32_t op_errno);
|
|
|
cb8e9e |
+int32_t ec_dispatch_one_retry(ec_fop_data_t *fop, int32_t idx, int32_t op_ret);
|
|
|
cb8e9e |
int32_t ec_dispatch_next(ec_fop_data_t * fop, int32_t idx);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
void ec_complete(ec_fop_data_t * fop);
|
|
|
cb8e9e |
diff --git a/xlators/cluster/ec/src/ec-dir-read.c b/xlators/cluster/ec/src/ec-dir-read.c
|
|
|
cb8e9e |
index 354c63d..7821878 100644
|
|
|
cb8e9e |
--- a/xlators/cluster/ec/src/ec-dir-read.c
|
|
|
cb8e9e |
+++ b/xlators/cluster/ec/src/ec-dir-read.c
|
|
|
cb8e9e |
@@ -361,7 +361,7 @@ int32_t ec_readdir_cbk(call_frame_t * frame, void * cookie, xlator_t * this,
|
|
|
cb8e9e |
ec_adjust_readdir(fop->xl->private, idx, entries);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- if (!ec_dispatch_one_retry(fop, idx, op_ret, op_errno))
|
|
|
cb8e9e |
+ if (!ec_dispatch_one_retry(fop, idx, op_ret))
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (fop->cbks.readdir != NULL)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
@@ -429,6 +429,8 @@ int32_t ec_manager_readdir(ec_fop_data_t * fop, int32_t state)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (fop->offset != 0)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
+ /* Non-zero offset is irrecoverable error as the offset may not be
|
|
|
cb8e9e |
+ * valid on other bricks*/
|
|
|
cb8e9e |
int32_t idx = -1;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
idx = ec_deitransform (fop->xl, fop->offset);
|
|
|
cb8e9e |
@@ -448,7 +450,6 @@ int32_t ec_manager_readdir(ec_fop_data_t * fop, int32_t state)
|
|
|
cb8e9e |
return EC_STATE_REPORT;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
case -EC_STATE_INIT:
|
|
|
cb8e9e |
- case -EC_STATE_REPORT:
|
|
|
cb8e9e |
if (fop->id == GF_FOP_READDIR)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (fop->cbks.readdir != NULL)
|
|
|
cb8e9e |
@@ -467,6 +468,7 @@ int32_t ec_manager_readdir(ec_fop_data_t * fop, int32_t state)
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
case EC_STATE_REPORT:
|
|
|
cb8e9e |
+ case -EC_STATE_REPORT:
|
|
|
cb8e9e |
return EC_STATE_END;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
default:
|
|
|
cb8e9e |
@@ -564,7 +566,7 @@ int32_t ec_readdirp_cbk(call_frame_t * frame, void * cookie, xlator_t * this,
|
|
|
cb8e9e |
ec_adjust_readdir(fop->xl->private, idx, entries);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- if (!ec_dispatch_one_retry(fop, idx, op_ret, op_errno))
|
|
|
cb8e9e |
+ if (!ec_dispatch_one_retry(fop, idx, op_ret))
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (fop->cbks.readdirp != NULL)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c
|
|
|
cb8e9e |
index ae02e96..ef2170f 100644
|
|
|
cb8e9e |
--- a/xlators/cluster/ec/src/ec-inode-read.c
|
|
|
cb8e9e |
+++ b/xlators/cluster/ec/src/ec-inode-read.c
|
|
|
cb8e9e |
@@ -35,7 +35,7 @@ int32_t ec_access_cbk(call_frame_t * frame, void * cookie, xlator_t * this,
|
|
|
cb8e9e |
ec_trace("CBK", fop, "idx=%d, frame=%p, op_ret=%d, op_errno=%d", idx,
|
|
|
cb8e9e |
frame, op_ret, op_errno);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- if (!ec_dispatch_one_retry(fop, idx, op_ret, op_errno))
|
|
|
cb8e9e |
+ if (!ec_dispatch_one_retry(fop, idx, op_ret))
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (fop->cbks.access != NULL)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
@@ -73,13 +73,13 @@ int32_t ec_manager_access(ec_fop_data_t * fop, int32_t state)
|
|
|
cb8e9e |
return EC_STATE_REPORT;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
case -EC_STATE_INIT:
|
|
|
cb8e9e |
- case -EC_STATE_REPORT:
|
|
|
cb8e9e |
if (fop->cbks.access != NULL)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
fop->cbks.access(fop->req_frame, fop, fop->xl, -1, fop->error,
|
|
|
cb8e9e |
NULL);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
+ case -EC_STATE_REPORT:
|
|
|
cb8e9e |
case EC_STATE_REPORT:
|
|
|
cb8e9e |
return EC_STATE_END;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -968,7 +968,7 @@ int32_t ec_readlink_cbk(call_frame_t * frame, void * cookie, xlator_t * this,
|
|
|
cb8e9e |
ec_iatt_rebuild(fop->xl->private, buf, 1, 1);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- if (!ec_dispatch_one_retry(fop, idx, op_ret, op_errno))
|
|
|
cb8e9e |
+ if (!ec_dispatch_one_retry(fop, idx, op_ret))
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
if (fop->cbks.readlink != NULL)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
@@ -1006,7 +1006,6 @@ int32_t ec_manager_readlink(ec_fop_data_t * fop, int32_t state)
|
|
|
cb8e9e |
return EC_STATE_REPORT;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
case -EC_STATE_INIT:
|
|
|
cb8e9e |
- case -EC_STATE_REPORT:
|
|
|
cb8e9e |
if (fop->cbks.readlink != NULL)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
fop->cbks.readlink(fop->req_frame, fop, fop->xl, -1,
|
|
|
cb8e9e |
@@ -1014,6 +1013,7 @@ int32_t ec_manager_readlink(ec_fop_data_t * fop, int32_t state)
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
case EC_STATE_REPORT:
|
|
|
cb8e9e |
+ case -EC_STATE_REPORT:
|
|
|
cb8e9e |
return EC_STATE_END;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
default:
|
|
|
cb8e9e |
--
|
|
|
cb8e9e |
1.7.1
|
|
|
cb8e9e |
|