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