diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2015-07-13 00:53:20 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-07-21 23:27:42 -0700 |
commit | b8a079b17f5aeb659ca35b9c7ec4b0ac7dc80406 (patch) | |
tree | 77a773178b1877395e4786818488aaac9a134394 /xlators/cluster/ec/src/ec-common.c | |
parent | 69e15a1d7ff40188872f87af8e8c80f4e891746a (diff) |
cluster/ec: Prevent data corruptions
- On lock reuse preserve 'healing' bits
- Don't set ctx->size outside locks in healing code
- Allow xattrop internal fops also on the fop->mask.
>Change-Id: I6b76da5d7ebe367d8f3552cbf9fd18e556f2a171
>BUG: 1232678
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
>Reviewed-on: http://review.gluster.org/11640
>Tested-by: NetBSD Build System <jenkins@build.gluster.org>
>Tested-by: Gluster Build System <jenkins@build.gluster.com>
>Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
BUG: 1243647
Change-Id: I1b3828e4d4a863b84b2c4e732e7965d1302cea47
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/11686
Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-common.c')
-rw-r--r-- | xlators/cluster/ec/src/ec-common.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c index 26c62deea77..18770f259a4 100644 --- a/xlators/cluster/ec/src/ec-common.c +++ b/xlators/cluster/ec/src/ec-common.c @@ -401,6 +401,18 @@ ec_must_wind (ec_fop_data_t *fop) return _gf_false; } +static gf_boolean_t +ec_internal_op (ec_fop_data_t *fop) +{ + if (ec_must_wind (fop)) + return _gf_true; + if (fop->id == GF_FOP_XATTROP) + return _gf_true; + if (fop->id == GF_FOP_FXATTROP) + return _gf_true; + return _gf_false; +} + int32_t ec_child_select(ec_fop_data_t * fop) { ec_t * ec = fop->xl->private; @@ -413,8 +425,9 @@ int32_t ec_child_select(ec_fop_data_t * fop) /* Wind the fop on same subvols as parent for any internal extra fops like * head/tail read in case of writev fop. Unlocks shouldn't do this because * unlock should go on all subvols where lock is performed*/ - if (fop->parent && !ec_must_wind (fop)) + if (fop->parent && !ec_internal_op (fop)) { fop->mask &= (fop->parent->mask & ~fop->parent->healing); + } mask = ec->xl_up; if (fop->parent == NULL) @@ -975,6 +988,7 @@ out: parent->mask &= fop->good; /*As of now only data healing marks bricks as healing*/ + lock->healing |= fop->healing; if (ec_is_data_fop (parent->id)) { parent->healing |= fop->healing; } @@ -999,9 +1013,13 @@ void ec_get_size_version(ec_lock_link_t *link) lock = link->lock; ctx = lock->ctx; + fop = link->fop; /* If ec metadata has already been retrieved, do not try again. */ if (ctx->have_info) { + if (ec_is_data_fop (fop->id)) { + fop->healing |= lock->healing; + } return; } @@ -1011,8 +1029,6 @@ void ec_get_size_version(ec_lock_link_t *link) return; } - fop = link->fop; - uid = fop->frame->root->uid; gid = fop->frame->root->gid; @@ -1277,6 +1293,7 @@ int32_t ec_locked(call_frame_t *frame, void *cookie, xlator_t *this, link = fop->data; lock = link->lock; lock->mask = lock->good_mask = fop->good; + lock->healing = 0; ec_lock_acquired(link); ec_lock(fop->parent); |