|
|
190130 |
From 7d87933f648092ae55d57a96fd06e3df975d764c Mon Sep 17 00:00:00 2001
|
|
|
190130 |
From: Ashish Pandey <aspandey@redhat.com>
|
|
|
190130 |
Date: Tue, 18 Aug 2020 10:33:48 +0530
|
|
|
190130 |
Subject: [PATCH 463/465] cluster/ec: Change handling of heal failure to avoid
|
|
|
190130 |
crash
|
|
|
190130 |
|
|
|
190130 |
Problem:
|
|
|
190130 |
ec_getxattr_heal_cbk was called with NULL as second argument
|
|
|
190130 |
in case heal was failing.
|
|
|
190130 |
This function was dereferencing "cookie" argument which caused crash.
|
|
|
190130 |
|
|
|
190130 |
Solution:
|
|
|
190130 |
Cookie is changed to carry the value that was supposed to be
|
|
|
190130 |
stored in fop->data, so even in the case when fop is NULL in error
|
|
|
190130 |
case, there won't be any NULL dereference.
|
|
|
190130 |
|
|
|
190130 |
Thanks to Xavi for the suggestion about the fix.
|
|
|
190130 |
|
|
|
190130 |
>Upstream patch: https://review.gluster.org/#/c/glusterfs/+/23050/
|
|
|
190130 |
>fixes: bz#1729085
|
|
|
190130 |
|
|
|
190130 |
Change-Id: I0798000d5cadb17c3c2fbfa1baf77033ffc2bb8c
|
|
|
190130 |
BUG: 1852736
|
|
|
190130 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/209012
|
|
|
190130 |
Tested-by: Ashish Pandey <aspandey@redhat.com>
|
|
|
190130 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
190130 |
Reviewed-by: Xavi Hernandez Juan <xhernandez@redhat.com>
|
|
|
190130 |
---
|
|
|
190130 |
xlators/cluster/ec/src/ec-heal.c | 11 ++++++-----
|
|
|
190130 |
xlators/cluster/ec/src/ec-inode-read.c | 4 ++--
|
|
|
190130 |
2 files changed, 8 insertions(+), 7 deletions(-)
|
|
|
190130 |
|
|
|
190130 |
diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c
|
|
|
190130 |
index 7d25853..6e6948b 100644
|
|
|
190130 |
--- a/xlators/cluster/ec/src/ec-heal.c
|
|
|
190130 |
+++ b/xlators/cluster/ec/src/ec-heal.c
|
|
|
190130 |
@@ -1966,7 +1966,7 @@ ec_manager_heal_block(ec_fop_data_t *fop, int32_t state)
|
|
|
190130 |
|
|
|
190130 |
case EC_STATE_REPORT:
|
|
|
190130 |
if (fop->cbks.heal) {
|
|
|
190130 |
- fop->cbks.heal(fop->req_frame, fop, fop->xl, 0, 0,
|
|
|
190130 |
+ fop->cbks.heal(fop->req_frame, fop->data, fop->xl, 0, 0,
|
|
|
190130 |
(heal->good | heal->bad), heal->good, heal->bad,
|
|
|
190130 |
0, NULL);
|
|
|
190130 |
}
|
|
|
190130 |
@@ -2022,10 +2022,11 @@ ec_heal_block_done(call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
190130 |
uintptr_t good, uintptr_t bad, uint32_t pending,
|
|
|
190130 |
dict_t *xdata)
|
|
|
190130 |
{
|
|
|
190130 |
- ec_fop_data_t *fop = cookie;
|
|
|
190130 |
- ec_heal_t *heal = fop->data;
|
|
|
190130 |
+ ec_heal_t *heal = cookie;
|
|
|
190130 |
|
|
|
190130 |
- fop->heal = NULL;
|
|
|
190130 |
+ if (heal->fop) {
|
|
|
190130 |
+ heal->fop->heal = NULL;
|
|
|
190130 |
+ }
|
|
|
190130 |
heal->fop = NULL;
|
|
|
190130 |
heal->error = op_ret < 0 ? op_errno : 0;
|
|
|
190130 |
syncbarrier_wake(heal->data);
|
|
|
190130 |
@@ -2669,7 +2670,7 @@ ec_heal_do(xlator_t *this, void *data, loc_t *loc, int32_t partial)
|
|
|
190130 |
out:
|
|
|
190130 |
ec_reset_entry_healing(fop);
|
|
|
190130 |
if (fop->cbks.heal) {
|
|
|
190130 |
- fop->cbks.heal(fop->req_frame, fop, fop->xl, op_ret, op_errno,
|
|
|
190130 |
+ fop->cbks.heal(fop->req_frame, fop->data, fop->xl, op_ret, op_errno,
|
|
|
190130 |
ec_char_array_to_mask(participants, ec->nodes),
|
|
|
190130 |
mgood & good, mbad & bad, pending, NULL);
|
|
|
190130 |
}
|
|
|
190130 |
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c
|
|
|
190130 |
index e82e8f6..c50d0ad 100644
|
|
|
190130 |
--- a/xlators/cluster/ec/src/ec-inode-read.c
|
|
|
190130 |
+++ b/xlators/cluster/ec/src/ec-inode-read.c
|
|
|
190130 |
@@ -396,8 +396,8 @@ ec_getxattr_heal_cbk(call_frame_t *frame, void *cookie, xlator_t *xl,
|
|
|
190130 |
uintptr_t good, uintptr_t bad, uint32_t pending,
|
|
|
190130 |
dict_t *xdata)
|
|
|
190130 |
{
|
|
|
190130 |
- ec_fop_data_t *fop = cookie;
|
|
|
190130 |
- fop_getxattr_cbk_t func = fop->data;
|
|
|
190130 |
+ fop_getxattr_cbk_t func = cookie;
|
|
|
190130 |
+
|
|
|
190130 |
ec_t *ec = xl->private;
|
|
|
190130 |
dict_t *dict = NULL;
|
|
|
190130 |
char *str;
|
|
|
190130 |
--
|
|
|
190130 |
1.8.3.1
|
|
|
190130 |
|