diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2019-07-18 11:25:31 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2019-07-26 07:10:45 +0000 |
commit | 11d52142f67638209be43007d993dc137412aa42 (patch) | |
tree | b34098c1cf725c9c91fe1d83347f5e2a3f7fe7c6 /xlators/cluster/ec/src/ec-inode-write.c | |
parent | 2af877cec513b1fca5a9f27b338117bacd5ab2f1 (diff) |
cluster/ec: Always read from good-mask
There are cases where fop->mask may have fop->healing added
and readv shouldn't be wound on fop->healing. To avoid this
always wind readv to lock->good_mask
fixes bz#1727081
Change-Id: I2226ef0229daf5ff315d51e868b980ee48060b87
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-inode-write.c')
-rw-r--r-- | xlators/cluster/ec/src/ec-inode-write.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c index 561015b9bbb..ec1c5b5d85c 100644 --- a/xlators/cluster/ec/src/ec-inode-write.c +++ b/xlators/cluster/ec/src/ec-inode-write.c @@ -1973,6 +1973,20 @@ ec_get_and_merge_stripe(ec_t *ec, ec_fop_data_t *fop, ec_stripe_part_t which) return found; } +static uintptr_t +ec_get_lock_good_mask(inode_t *inode, xlator_t *xl) +{ + ec_lock_t *lock = NULL; + ec_inode_t *ictx = NULL; + LOCK(&inode->lock); + { + ictx = __ec_inode_get(inode, xl); + lock = ictx->inode_lock; + } + UNLOCK(&inode->lock); + return lock->good_mask; +} + void ec_writev_start(ec_fop_data_t *fop) { @@ -2018,9 +2032,10 @@ ec_writev_start(ec_fop_data_t *fop) err = -ENOMEM; goto failed_xdata; } - ec_readv(fop->frame, fop->xl, -1, EC_MINIMUM_MIN, - ec_writev_merge_head, NULL, fd, ec->stripe_size, - fop->offset, 0, xdata); + ec_readv(fop->frame, fop->xl, + ec_get_lock_good_mask(fop->fd->inode, fop->xl), + EC_MINIMUM_MIN, ec_writev_merge_head, NULL, fd, + ec->stripe_size, fop->offset, 0, xdata); } } else { memset(fop->vector[0].iov_base, 0, fop->head); @@ -2043,8 +2058,10 @@ ec_writev_start(ec_fop_data_t *fop) err = -ENOMEM; goto failed_xdata; } - ec_readv(fop->frame, fop->xl, -1, EC_MINIMUM_MIN, - ec_writev_merge_tail, NULL, fd, ec->stripe_size, + ec_readv(fop->frame, fop->xl, + ec_get_lock_good_mask(fop->fd->inode, fop->xl), + EC_MINIMUM_MIN, ec_writev_merge_tail, NULL, fd, + ec->stripe_size, fop->offset + fop->size - ec->stripe_size, 0, xdata); } } else { |