You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
189 lines
7.1 KiB
189 lines
7.1 KiB
3 years ago
|
From bde1ad97f8739f8370a2bbb92229b1b397ecd82c Mon Sep 17 00:00:00 2001
|
||
|
From: karthik-us <ksubrahm@redhat.com>
|
||
|
Date: Tue, 8 Dec 2020 19:06:03 +0530
|
||
|
Subject: [PATCH 492/511] afr/lookup: Pass xattr_req in while doing a selfheal
|
||
|
in lookup
|
||
|
|
||
|
We were not passing xattr_req when doing a name self heal
|
||
|
as well as a meta data heal. Because of this, some xdata
|
||
|
was missing which causes i/o errors
|
||
|
|
||
|
Upstream patch details:
|
||
|
> Change-Id: Ibfb1205a7eb0195632dc3820116ffbbb8043545f
|
||
|
> Fixes: bz#1728770
|
||
|
> Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
|
||
|
Upstream Patch : https://review.gluster.org/#/c/glusterfs/+/23024/
|
||
|
|
||
|
BUG: 1726673
|
||
|
Change-Id: Ibfb1205a7eb0195632dc3820116ffbbb8043545f
|
||
|
Signed-off-by: karthik-us <ksubrahm@redhat.com>
|
||
|
Reviewed-on: https://code.engineering.redhat.com/gerrit/220538
|
||
|
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
||
|
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
||
|
---
|
||
|
tests/bugs/replicate/bug-1728770-pass-xattrs.t | 52 ++++++++++++++++++++++++++
|
||
|
tests/include.rc | 1 +
|
||
|
xlators/cluster/afr/src/afr-common.c | 8 +++-
|
||
|
xlators/cluster/afr/src/afr-self-heal-common.c | 9 ++++-
|
||
|
xlators/cluster/afr/src/afr-self-heal.h | 2 +-
|
||
|
5 files changed, 67 insertions(+), 5 deletions(-)
|
||
|
create mode 100644 tests/bugs/replicate/bug-1728770-pass-xattrs.t
|
||
|
|
||
|
diff --git a/tests/bugs/replicate/bug-1728770-pass-xattrs.t b/tests/bugs/replicate/bug-1728770-pass-xattrs.t
|
||
|
new file mode 100644
|
||
|
index 0000000..159c4fc
|
||
|
--- /dev/null
|
||
|
+++ b/tests/bugs/replicate/bug-1728770-pass-xattrs.t
|
||
|
@@ -0,0 +1,52 @@
|
||
|
+#!/bin/bash
|
||
|
+
|
||
|
+. $(dirname $0)/../../include.rc
|
||
|
+. $(dirname $0)/../../volume.rc
|
||
|
+. $(dirname $0)/../../snapshot.rc
|
||
|
+
|
||
|
+cleanup;
|
||
|
+
|
||
|
+function fop_on_bad_disk {
|
||
|
+ local path=$1
|
||
|
+ mkdir $path/dir{1..1000} 2>/dev/null
|
||
|
+ mv $path/dir1 $path/newdir
|
||
|
+ touch $path/foo.txt
|
||
|
+ echo $?
|
||
|
+}
|
||
|
+
|
||
|
+function ls_fop_on_bad_disk {
|
||
|
+ local path=$1
|
||
|
+ ls $path
|
||
|
+ echo $?
|
||
|
+}
|
||
|
+
|
||
|
+TEST init_n_bricks 6;
|
||
|
+TEST setup_lvm 6;
|
||
|
+
|
||
|
+TEST glusterd;
|
||
|
+TEST pidof glusterd;
|
||
|
+
|
||
|
+TEST $CLI volume create $V0 replica 3 $H0:$L1 $H0:$L2 $H0:$L3 $H0:$L4 $H0:$L5 $H0:$L6;
|
||
|
+TEST $CLI volume set $V0 health-check-interval 1000;
|
||
|
+
|
||
|
+TEST $CLI volume start $V0;
|
||
|
+
|
||
|
+TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0;
|
||
|
+#corrupt last disk
|
||
|
+dd if=/dev/urandom of=/dev/mapper/patchy_snap_vg_6-brick_lvm bs=512K count=200 status=progress && sync
|
||
|
+
|
||
|
+
|
||
|
+# Test the disk is now returning EIO for touch and ls
|
||
|
+EXPECT_WITHIN $DISK_FAIL_TIMEOUT "^1$" fop_on_bad_disk "$L6"
|
||
|
+EXPECT_WITHIN $DISK_FAIL_TIMEOUT "^2$" ls_fop_on_bad_disk "$L6"
|
||
|
+
|
||
|
+TEST touch $M0/foo{1..100}
|
||
|
+TEST $CLI volume remove-brick $V0 replica 3 $H0:$L4 $H0:$L5 $H0:$L6 start
|
||
|
+EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" remove_brick_status_completed_field "$V0" "$H0:$L4 $H0:$L5 $H0:$L6";
|
||
|
+
|
||
|
+#check that remove-brick status should not have any failed or skipped files
|
||
|
+var=`$CLI volume remove-brick $V0 $H0:$L4 $H0:$L5 $H0:$L6 status | grep completed`
|
||
|
+TEST [ `echo $var | awk '{print $5}'` = "0" ]
|
||
|
+TEST [ `echo $var | awk '{print $6}'` = "0" ]
|
||
|
+
|
||
|
+cleanup;
|
||
|
diff --git a/tests/include.rc b/tests/include.rc
|
||
|
index 762c5e2..c925941 100644
|
||
|
--- a/tests/include.rc
|
||
|
+++ b/tests/include.rc
|
||
|
@@ -89,6 +89,7 @@ GRAPH_SWITCH_TIMEOUT=10
|
||
|
UNLINK_TIMEOUT=5
|
||
|
MDC_TIMEOUT=5
|
||
|
IO_WAIT_TIMEOUT=5
|
||
|
+DISK_FAIL_TIMEOUT=80
|
||
|
|
||
|
LOGDIR=$(gluster --print-logdir)
|
||
|
|
||
|
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
|
||
|
index 851ccad..fca2cd5 100644
|
||
|
--- a/xlators/cluster/afr/src/afr-common.c
|
||
|
+++ b/xlators/cluster/afr/src/afr-common.c
|
||
|
@@ -2609,6 +2609,10 @@ afr_lookup_sh_metadata_wrap(void *opaque)
|
||
|
dict = dict_new();
|
||
|
if (!dict)
|
||
|
goto out;
|
||
|
+ if (local->xattr_req) {
|
||
|
+ dict_copy(local->xattr_req, dict);
|
||
|
+ }
|
||
|
+
|
||
|
ret = dict_set_sizen_str_sizen(dict, "link-count", GF_XATTROP_INDEX_COUNT);
|
||
|
if (ret) {
|
||
|
gf_msg_debug(this->name, -ret, "Unable to set link-count in dict ");
|
||
|
@@ -2617,7 +2621,7 @@ afr_lookup_sh_metadata_wrap(void *opaque)
|
||
|
if (loc_is_nameless(&local->loc)) {
|
||
|
ret = afr_selfheal_unlocked_discover_on(frame, local->inode,
|
||
|
local->loc.gfid, local->replies,
|
||
|
- local->child_up);
|
||
|
+ local->child_up, dict);
|
||
|
} else {
|
||
|
inode = afr_selfheal_unlocked_lookup_on(frame, local->loc.parent,
|
||
|
local->loc.name, local->replies,
|
||
|
@@ -2791,7 +2795,7 @@ afr_lookup_selfheal_wrap(void *opaque)
|
||
|
|
||
|
inode = afr_selfheal_unlocked_lookup_on(frame, local->loc.parent,
|
||
|
local->loc.name, local->replies,
|
||
|
- local->child_up, NULL);
|
||
|
+ local->child_up, local->xattr_req);
|
||
|
if (inode)
|
||
|
inode_unref(inode);
|
||
|
|
||
|
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
|
||
|
index 36fd3a9..9b6575f 100644
|
||
|
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
|
||
|
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
|
||
|
@@ -1861,7 +1861,7 @@ afr_set_multi_dom_lock_count_request(xlator_t *this, dict_t *dict)
|
||
|
int
|
||
|
afr_selfheal_unlocked_discover_on(call_frame_t *frame, inode_t *inode,
|
||
|
uuid_t gfid, struct afr_reply *replies,
|
||
|
- unsigned char *discover_on)
|
||
|
+ unsigned char *discover_on, dict_t *dict)
|
||
|
{
|
||
|
loc_t loc = {
|
||
|
0,
|
||
|
@@ -1876,6 +1876,8 @@ afr_selfheal_unlocked_discover_on(call_frame_t *frame, inode_t *inode,
|
||
|
xattr_req = dict_new();
|
||
|
if (!xattr_req)
|
||
|
return -ENOMEM;
|
||
|
+ if (dict)
|
||
|
+ dict_copy(dict, xattr_req);
|
||
|
|
||
|
if (afr_xattr_req_prepare(frame->this, xattr_req) != 0) {
|
||
|
dict_unref(xattr_req);
|
||
|
@@ -1906,11 +1908,14 @@ afr_selfheal_unlocked_discover(call_frame_t *frame, inode_t *inode, uuid_t gfid,
|
||
|
struct afr_reply *replies)
|
||
|
{
|
||
|
afr_local_t *local = NULL;
|
||
|
+ dict_t *dict = NULL;
|
||
|
|
||
|
local = frame->local;
|
||
|
+ if (local && local->xattr_req)
|
||
|
+ dict = local->xattr_req;
|
||
|
|
||
|
return afr_selfheal_unlocked_discover_on(frame, inode, gfid, replies,
|
||
|
- local->child_up);
|
||
|
+ local->child_up, dict);
|
||
|
}
|
||
|
|
||
|
unsigned int
|
||
|
diff --git a/xlators/cluster/afr/src/afr-self-heal.h b/xlators/cluster/afr/src/afr-self-heal.h
|
||
|
index b39af02..8f6fb00 100644
|
||
|
--- a/xlators/cluster/afr/src/afr-self-heal.h
|
||
|
+++ b/xlators/cluster/afr/src/afr-self-heal.h
|
||
|
@@ -188,7 +188,7 @@ afr_selfheal_unlocked_discover(call_frame_t *frame, inode_t *inode, uuid_t gfid,
|
||
|
int
|
||
|
afr_selfheal_unlocked_discover_on(call_frame_t *frame, inode_t *inode,
|
||
|
uuid_t gfid, struct afr_reply *replies,
|
||
|
- unsigned char *discover_on);
|
||
|
+ unsigned char *discover_on, dict_t *dict);
|
||
|
inode_t *
|
||
|
afr_selfheal_unlocked_lookup_on(call_frame_t *frame, inode_t *parent,
|
||
|
const char *name, struct afr_reply *replies,
|
||
|
--
|
||
|
1.8.3.1
|
||
|
|