|
|
21ab4e |
From 336fe9a4b5b7a10a89b2bdb3628daeeda32e9b1b Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Ashish Pandey <aspandey@redhat.com>
|
|
|
21ab4e |
Date: Fri, 28 Jul 2017 15:18:29 +0530
|
|
|
21ab4e |
Subject: [PATCH 580/587] ec/cluster: Update failure of fop on a brick properly
|
|
|
21ab4e |
|
|
|
21ab4e |
Problem:
|
|
|
21ab4e |
In case of truncate, if writev or open fails on a brick,
|
|
|
21ab4e |
in some cases it does not mark the failure onlock->good_mask.
|
|
|
21ab4e |
This causes the update of size and version on all the bricks
|
|
|
21ab4e |
even if it has failed on one of the brick. That ultimately
|
|
|
21ab4e |
causes a data corruption.
|
|
|
21ab4e |
|
|
|
21ab4e |
Solution:
|
|
|
21ab4e |
In callback of such writev and open calls, mark fop->good
|
|
|
21ab4e |
for parent too.
|
|
|
21ab4e |
|
|
|
21ab4e |
Thanks Pranith Kumar K <pkarampu@redhat.com> for finding the
|
|
|
21ab4e |
root cause.
|
|
|
21ab4e |
|
|
|
21ab4e |
>Change-Id: I8a1da2888bff53b91a0d362b8c44fcdf658e7466
|
|
|
21ab4e |
>BUG: 1476205
|
|
|
21ab4e |
>Signed-off-by: Ashish Pandey <aspandey@redhat.com>
|
|
|
21ab4e |
>Reviewed-on: https://review.gluster.org/17906
|
|
|
21ab4e |
>Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
|
|
|
21ab4e |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>Signed-off-by: Ashish Pandey <aspandey@redhat.com>
|
|
|
21ab4e |
|
|
|
21ab4e |
Change-Id: I8a1da2888bff53b91a0d362b8c44fcdf658e7466
|
|
|
21ab4e |
BUG: 1472764
|
|
|
21ab4e |
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/113931
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
xlators/cluster/ec/src/ec-inode-write.c | 23 ++++++++++++++++-------
|
|
|
21ab4e |
1 file changed, 16 insertions(+), 7 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c
|
|
|
21ab4e |
index 8b72373..3664f0e 100644
|
|
|
21ab4e |
--- a/xlators/cluster/ec/src/ec-inode-write.c
|
|
|
21ab4e |
+++ b/xlators/cluster/ec/src/ec-inode-write.c
|
|
|
21ab4e |
@@ -1024,11 +1024,19 @@ out:
|
|
|
21ab4e |
}
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
-/*********************************************************************
|
|
|
21ab4e |
- *
|
|
|
21ab4e |
- * File Operation : truncate
|
|
|
21ab4e |
- *
|
|
|
21ab4e |
- *********************************************************************/
|
|
|
21ab4e |
+int32_t
|
|
|
21ab4e |
+ec_truncate_writev_cbk (call_frame_t *frame, void *cookie,
|
|
|
21ab4e |
+ xlator_t *this, int32_t op_ret, int32_t op_errno,
|
|
|
21ab4e |
+ struct iatt *prebuf, struct iatt *postbuf,
|
|
|
21ab4e |
+ dict_t *xdata)
|
|
|
21ab4e |
+{
|
|
|
21ab4e |
+ ec_fop_data_t *fop = cookie;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ fop->parent->good &= fop->good;
|
|
|
21ab4e |
+ ec_trace("TRUNCATE_WRITEV_CBK", cookie, "ret=%d, errno=%d",
|
|
|
21ab4e |
+ op_ret, op_errno);
|
|
|
21ab4e |
+ return 0;
|
|
|
21ab4e |
+}
|
|
|
21ab4e |
|
|
|
21ab4e |
int32_t ec_truncate_write(ec_fop_data_t * fop, uintptr_t mask)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
@@ -1058,8 +1066,8 @@ int32_t ec_truncate_write(ec_fop_data_t * fop, uintptr_t mask)
|
|
|
21ab4e |
iobuf_unref (iobuf);
|
|
|
21ab4e |
iobuf = NULL;
|
|
|
21ab4e |
|
|
|
21ab4e |
- ec_writev(fop->frame, fop->xl, mask, fop->minimum, NULL, NULL, fop->fd,
|
|
|
21ab4e |
- &vector, 1, fop->user_size, 0, iobref, NULL);
|
|
|
21ab4e |
+ ec_writev(fop->frame, fop->xl, mask, fop->minimum, ec_truncate_writev_cbk,
|
|
|
21ab4e |
+ NULL, fop->fd, &vector, 1, fop->user_size, 0, iobref, NULL);
|
|
|
21ab4e |
|
|
|
21ab4e |
err = 0;
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -1081,6 +1089,7 @@ int32_t ec_truncate_open_cbk(call_frame_t * frame, void * cookie,
|
|
|
21ab4e |
ec_fop_data_t * fop = cookie;
|
|
|
21ab4e |
int32_t err;
|
|
|
21ab4e |
|
|
|
21ab4e |
+ fop->parent->good &= fop->good;
|
|
|
21ab4e |
if (op_ret >= 0) {
|
|
|
21ab4e |
fd_bind (fd);
|
|
|
21ab4e |
err = ec_truncate_write(fop->parent, fop->answer->mask);
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|