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