|
|
74096c |
From 8c366f34a279a5ab2a6301bfd93534fe746a23e8 Mon Sep 17 00:00:00 2001
|
|
|
74096c |
From: Ravishankar N <ravishankar@redhat.com>
|
|
|
74096c |
Date: Mon, 7 Dec 2020 09:53:27 +0530
|
|
|
74096c |
Subject: [PATCH 483/511] afr: more quorum checks in lookup and new entry
|
|
|
74096c |
marking
|
|
|
74096c |
|
|
|
74096c |
Problem: See upstream github issue for details.
|
|
|
74096c |
|
|
|
74096c |
Fix:
|
|
|
74096c |
-In lookup if the entry exists in 2 out of 3 bricks, don't fail the
|
|
|
74096c |
lookup with ENOENT just because there is an entrylk on the parent.
|
|
|
74096c |
Consider quorum before deciding.
|
|
|
74096c |
|
|
|
74096c |
-If entry FOP does not succeed on quorum no. of bricks, do not perform
|
|
|
74096c |
new entry mark.
|
|
|
74096c |
|
|
|
74096c |
Upstream patch details:
|
|
|
74096c |
> Reviewed-on: https://review.gluster.org/#/c/glusterfs/+/24499/
|
|
|
74096c |
> Fixes: #1303
|
|
|
74096c |
> Change-Id: I56df8c89ad53b29fa450c7930a7b7ccec9f4a6c5
|
|
|
74096c |
> Signed-off-by: Ravishankar N <ravishankar@redhat.com>
|
|
|
74096c |
|
|
|
74096c |
BUG: 1821599
|
|
|
74096c |
Change-Id: If513e8a7d6088a676288927630d8e616269bf5d5
|
|
|
74096c |
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
|
|
|
74096c |
Reviewed-on: https://code.engineering.redhat.com/gerrit/220363
|
|
|
74096c |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
74096c |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
74096c |
---
|
|
|
74096c |
...20-mark-dirty-for-entry-txn-on-quorum-failure.t | 2 --
|
|
|
74096c |
xlators/cluster/afr/src/afr-common.c | 24 ++++++++++++----------
|
|
|
74096c |
xlators/cluster/afr/src/afr-dir-write.c | 8 ++++++++
|
|
|
74096c |
xlators/cluster/afr/src/afr.h | 4 ++++
|
|
|
74096c |
4 files changed, 25 insertions(+), 13 deletions(-)
|
|
|
74096c |
|
|
|
74096c |
diff --git a/tests/bugs/replicate/bug-1586020-mark-dirty-for-entry-txn-on-quorum-failure.t b/tests/bugs/replicate/bug-1586020-mark-dirty-for-entry-txn-on-quorum-failure.t
|
|
|
74096c |
index 26f9049..49c4dea 100644
|
|
|
74096c |
--- a/tests/bugs/replicate/bug-1586020-mark-dirty-for-entry-txn-on-quorum-failure.t
|
|
|
74096c |
+++ b/tests/bugs/replicate/bug-1586020-mark-dirty-for-entry-txn-on-quorum-failure.t
|
|
|
74096c |
@@ -53,8 +53,6 @@ TEST ! ls $B0/${V0}1/file$i
|
|
|
74096c |
TEST ls $B0/${V0}2/file$i
|
|
|
74096c |
dirty=$(get_hex_xattr trusted.afr.dirty $B0/${V0}2)
|
|
|
74096c |
TEST [ "$dirty" != "000000000000000000000000" ]
|
|
|
74096c |
-EXPECT "000000010000000100000000" get_hex_xattr trusted.afr.$V0-client-0 $B0/${V0}2/file$i
|
|
|
74096c |
-EXPECT "000000010000000100000000" get_hex_xattr trusted.afr.$V0-client-1 $B0/${V0}2/file$i
|
|
|
74096c |
|
|
|
74096c |
TEST $CLI volume set $V0 self-heal-daemon on
|
|
|
74096c |
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
|
|
|
74096c |
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
|
|
|
74096c |
index 89e2483..851ccad 100644
|
|
|
74096c |
--- a/xlators/cluster/afr/src/afr-common.c
|
|
|
74096c |
+++ b/xlators/cluster/afr/src/afr-common.c
|
|
|
74096c |
@@ -1236,7 +1236,7 @@ refresh_done:
|
|
|
74096c |
return 0;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
-static void
|
|
|
74096c |
+void
|
|
|
74096c |
afr_fill_success_replies(afr_local_t *local, afr_private_t *priv,
|
|
|
74096c |
unsigned char *replies)
|
|
|
74096c |
{
|
|
|
74096c |
@@ -2290,6 +2290,7 @@ afr_lookup_done(call_frame_t *frame, xlator_t *this)
|
|
|
74096c |
0,
|
|
|
74096c |
};
|
|
|
74096c |
gf_boolean_t locked_entry = _gf_false;
|
|
|
74096c |
+ gf_boolean_t in_flight_create = _gf_false;
|
|
|
74096c |
gf_boolean_t can_interpret = _gf_true;
|
|
|
74096c |
inode_t *parent = NULL;
|
|
|
74096c |
ia_type_t ia_type = IA_INVAL;
|
|
|
74096c |
@@ -2333,17 +2334,12 @@ afr_lookup_done(call_frame_t *frame, xlator_t *this)
|
|
|
74096c |
if (!replies[i].valid)
|
|
|
74096c |
continue;
|
|
|
74096c |
|
|
|
74096c |
- if (locked_entry && replies[i].op_ret == -1 &&
|
|
|
74096c |
- replies[i].op_errno == ENOENT) {
|
|
|
74096c |
- /* Second, check entry is still
|
|
|
74096c |
- "underway" in creation */
|
|
|
74096c |
- local->op_ret = -1;
|
|
|
74096c |
- local->op_errno = ENOENT;
|
|
|
74096c |
- goto error;
|
|
|
74096c |
- }
|
|
|
74096c |
-
|
|
|
74096c |
- if (replies[i].op_ret == -1)
|
|
|
74096c |
+ if (replies[i].op_ret == -1) {
|
|
|
74096c |
+ if (locked_entry && replies[i].op_errno == ENOENT) {
|
|
|
74096c |
+ in_flight_create = _gf_true;
|
|
|
74096c |
+ }
|
|
|
74096c |
continue;
|
|
|
74096c |
+ }
|
|
|
74096c |
|
|
|
74096c |
if (read_subvol == -1 || !readable[read_subvol]) {
|
|
|
74096c |
read_subvol = i;
|
|
|
74096c |
@@ -2353,6 +2349,12 @@ afr_lookup_done(call_frame_t *frame, xlator_t *this)
|
|
|
74096c |
}
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
+ if (in_flight_create && !afr_has_quorum(success_replies, this, NULL)) {
|
|
|
74096c |
+ local->op_ret = -1;
|
|
|
74096c |
+ local->op_errno = ENOENT;
|
|
|
74096c |
+ goto error;
|
|
|
74096c |
+ }
|
|
|
74096c |
+
|
|
|
74096c |
if (read_subvol == -1)
|
|
|
74096c |
goto error;
|
|
|
74096c |
/* We now have a read_subvol, which is readable[] (if there
|
|
|
74096c |
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
|
|
|
74096c |
index 84e2a34..416c19d 100644
|
|
|
74096c |
--- a/xlators/cluster/afr/src/afr-dir-write.c
|
|
|
74096c |
+++ b/xlators/cluster/afr/src/afr-dir-write.c
|
|
|
74096c |
@@ -349,6 +349,7 @@ afr_mark_entry_pending_changelog(call_frame_t *frame, xlator_t *this)
|
|
|
74096c |
afr_private_t *priv = NULL;
|
|
|
74096c |
int pre_op_count = 0;
|
|
|
74096c |
int failed_count = 0;
|
|
|
74096c |
+ unsigned char *success_replies = NULL;
|
|
|
74096c |
|
|
|
74096c |
local = frame->local;
|
|
|
74096c |
priv = this->private;
|
|
|
74096c |
@@ -364,9 +365,16 @@ afr_mark_entry_pending_changelog(call_frame_t *frame, xlator_t *this)
|
|
|
74096c |
failed_count = AFR_COUNT(local->transaction.failed_subvols,
|
|
|
74096c |
priv->child_count);
|
|
|
74096c |
|
|
|
74096c |
+ /* FOP succeeded on all bricks. */
|
|
|
74096c |
if (pre_op_count == priv->child_count && !failed_count)
|
|
|
74096c |
return;
|
|
|
74096c |
|
|
|
74096c |
+ /* FOP did not suceed on quorum no. of bricks. */
|
|
|
74096c |
+ success_replies = alloca0(priv->child_count);
|
|
|
74096c |
+ afr_fill_success_replies(local, priv, success_replies);
|
|
|
74096c |
+ if (!afr_has_quorum(success_replies, this, NULL))
|
|
|
74096c |
+ return;
|
|
|
74096c |
+
|
|
|
74096c |
if (priv->thin_arbiter_count) {
|
|
|
74096c |
/*Mark new entry using ta file*/
|
|
|
74096c |
local->is_new_entry = _gf_true;
|
|
|
74096c |
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
|
|
|
74096c |
index ff96246..ed5096e 100644
|
|
|
74096c |
--- a/xlators/cluster/afr/src/afr.h
|
|
|
74096c |
+++ b/xlators/cluster/afr/src/afr.h
|
|
|
74096c |
@@ -1334,4 +1334,8 @@ afr_mark_new_entry_changelog(call_frame_t *frame, xlator_t *this);
|
|
|
74096c |
|
|
|
74096c |
void
|
|
|
74096c |
afr_selfheal_childup(xlator_t *this, afr_private_t *priv);
|
|
|
74096c |
+
|
|
|
74096c |
+void
|
|
|
74096c |
+afr_fill_success_replies(afr_local_t *local, afr_private_t *priv,
|
|
|
74096c |
+ unsigned char *replies);
|
|
|
74096c |
#endif /* __AFR_H__ */
|
|
|
74096c |
--
|
|
|
74096c |
1.8.3.1
|
|
|
74096c |
|