summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2018-09-20 10:14:26 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2018-09-21 16:35:26 +0000
commit9d8f5a34c1ff4ae512f80fe9651508ae201c273e (patch)
tree32c54faf293bc707280820a11c8bd8c7cbfe5a9f /xlators
parentd901308a06c38fa53a3b07ed1641522a3248378d (diff)
afr: fix incorrect reporting of directory split-brain
Problem: When a directory has dirty xattrs due to failed post-ops or when replace/reset brick is performed, AFR does a conservative merge as expected, but heal-info reports it as split-brain because there are no clear sources. Fix: Modify pending flag to contain information about pending heals and split-brains. For directories, if spit-brain flag is not set,just show them as needing heal and not being in split-brain. Fixes: bz#1626994 Change-Id: I09ef821f6887c87d315ae99e6b1de05103cd9383 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-common.c14
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c6
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-data.c2
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-entry.c2
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-metadata.c2
-rw-r--r--xlators/cluster/afr/src/afr-self-heal.h8
-rw-r--r--xlators/cluster/afr/src/afr.h4
7 files changed, 22 insertions, 16 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 73f1d728809..a0ff6acd9dd 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -5814,7 +5814,7 @@ out:
int
afr_selfheal_locked_metadata_inspect(call_frame_t *frame, xlator_t *this,
inode_t *inode, gf_boolean_t *msh,
- gf_boolean_t *pending)
+ unsigned char *pending)
{
int ret = -1;
unsigned char *locked_on = NULL;
@@ -5859,7 +5859,7 @@ out:
int
afr_selfheal_locked_data_inspect(call_frame_t *frame, xlator_t *this, fd_t *fd,
- gf_boolean_t *dsh, gf_boolean_t *pflag)
+ gf_boolean_t *dsh, unsigned char *pflag)
{
int ret = -1;
unsigned char *data_lock = NULL;
@@ -5903,7 +5903,7 @@ out:
int
afr_selfheal_locked_entry_inspect(call_frame_t *frame, xlator_t *this,
inode_t *inode, gf_boolean_t *esh,
- gf_boolean_t *pflag)
+ unsigned char *pflag)
{
int ret = -1;
int source = -1;
@@ -5952,7 +5952,7 @@ afr_selfheal_locked_entry_inspect(call_frame_t *frame, xlator_t *this,
ret = __afr_selfheal_entry_prepare(frame, this, inode, data_lock,
sources, sinks, healed_sinks,
locked_replies, &source, pflag);
- if ((ret == 0) && source < 0)
+ if ((ret == 0) && (*pflag & PFLAG_SBRAIN))
ret = -EIO;
*esh = afr_decide_heal_info(priv, sources, ret);
}
@@ -5974,7 +5974,7 @@ afr_selfheal_locked_inspect(call_frame_t *frame, xlator_t *this, uuid_t gfid,
inode_t **inode, gf_boolean_t *entry_selfheal,
gf_boolean_t *data_selfheal,
gf_boolean_t *metadata_selfheal,
- gf_boolean_t *pending)
+ unsigned char *pending)
{
int ret = -1;
@@ -6059,7 +6059,7 @@ afr_get_heal_info(call_frame_t *frame, xlator_t *this, loc_t *loc)
gf_boolean_t data_selfheal = _gf_false;
gf_boolean_t metadata_selfheal = _gf_false;
gf_boolean_t entry_selfheal = _gf_false;
- gf_boolean_t pending = _gf_false;
+ unsigned char pending = 0;
dict_t *dict = NULL;
int ret = -1;
int op_errno = 0;
@@ -6077,7 +6077,7 @@ afr_get_heal_info(call_frame_t *frame, xlator_t *this, loc_t *loc)
goto out;
}
- if (pending) {
+ if (pending & PFLAG_PENDING) {
gf_asprintf(&substr, "-pending");
if (!substr)
goto out;
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index c48c47683c3..402f5ea5888 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -1513,7 +1513,7 @@ afr_selfheal_find_direction(call_frame_t *frame, xlator_t *this,
struct afr_reply *replies,
afr_transaction_type type, unsigned char *locked_on,
unsigned char *sources, unsigned char *sinks,
- uint64_t *witness, gf_boolean_t *pflag)
+ uint64_t *witness, unsigned char *pflag)
{
afr_private_t *priv = NULL;
int i = 0;
@@ -1541,7 +1541,7 @@ afr_selfheal_find_direction(call_frame_t *frame, xlator_t *this,
for (i = 0; i < priv->child_count; i++) {
for (j = 0; j < priv->child_count; j++)
if (matrix[i][j])
- *pflag = _gf_true;
+ *pflag |= PFLAG_PENDING;
if (*pflag)
break;
}
@@ -1623,6 +1623,8 @@ afr_selfheal_find_direction(call_frame_t *frame, xlator_t *this,
if (locked_on[i])
sinks[i] = 1;
}
+ if (pflag)
+ *pflag |= PFLAG_SBRAIN;
}
/* One more class of witness similar to dirty in v2 is where no pending
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
index a477fae8039..a3650a3b22d 100644
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
@@ -597,7 +597,7 @@ __afr_selfheal_data_prepare(call_frame_t *frame, xlator_t *this, inode_t *inode,
unsigned char *locked_on, unsigned char *sources,
unsigned char *sinks, unsigned char *healed_sinks,
unsigned char *undid_pending,
- struct afr_reply *replies, gf_boolean_t *pflag)
+ struct afr_reply *replies, unsigned char *pflag)
{
int ret = -1;
int source = -1;
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
index bf7a6b9d1e8..619558e94b7 100644
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
@@ -487,7 +487,7 @@ __afr_selfheal_entry_prepare(call_frame_t *frame, xlator_t *this,
unsigned char *sources, unsigned char *sinks,
unsigned char *healed_sinks,
struct afr_reply *replies, int *source_p,
- gf_boolean_t *pflag)
+ unsigned char *pflag)
{
int ret = -1;
int source = -1;
diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c
index be6e574b6ca..ea2a7bfd52f 100644
--- a/xlators/cluster/afr/src/afr-self-heal-metadata.c
+++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c
@@ -310,7 +310,7 @@ __afr_selfheal_metadata_prepare(call_frame_t *frame, xlator_t *this,
unsigned char *sources, unsigned char *sinks,
unsigned char *healed_sinks,
unsigned char *undid_pending,
- struct afr_reply *replies, gf_boolean_t *pflag)
+ struct afr_reply *replies, unsigned char *pflag)
{
int ret = -1;
int source = -1;
diff --git a/xlators/cluster/afr/src/afr-self-heal.h b/xlators/cluster/afr/src/afr-self-heal.h
index 545e67f774d..9c7418c7169 100644
--- a/xlators/cluster/afr/src/afr-self-heal.h
+++ b/xlators/cluster/afr/src/afr-self-heal.h
@@ -177,7 +177,7 @@ afr_selfheal_find_direction(call_frame_t *frame, xlator_t *this,
struct afr_reply *replies,
afr_transaction_type type, unsigned char *locked_on,
unsigned char *sources, unsigned char *sinks,
- uint64_t *witness, gf_boolean_t *flag);
+ uint64_t *witness, unsigned char *flag);
int
afr_selfheal_fill_matrix(xlator_t *this, int **matrix, int subvol, int idx,
dict_t *xdata);
@@ -284,7 +284,7 @@ __afr_selfheal_data_prepare(call_frame_t *frame, xlator_t *this, inode_t *inode,
unsigned char *locked_on, unsigned char *sources,
unsigned char *sinks, unsigned char *healed_sinks,
unsigned char *undid_pending,
- struct afr_reply *replies, gf_boolean_t *flag);
+ struct afr_reply *replies, unsigned char *flag);
int
__afr_selfheal_metadata_prepare(call_frame_t *frame, xlator_t *this,
@@ -292,14 +292,14 @@ __afr_selfheal_metadata_prepare(call_frame_t *frame, xlator_t *this,
unsigned char *sources, unsigned char *sinks,
unsigned char *healed_sinks,
unsigned char *undid_pending,
- struct afr_reply *replies, gf_boolean_t *flag);
+ struct afr_reply *replies, unsigned char *flag);
int
__afr_selfheal_entry_prepare(call_frame_t *frame, xlator_t *this,
inode_t *inode, unsigned char *locked_on,
unsigned char *sources, unsigned char *sinks,
unsigned char *healed_sinks,
struct afr_reply *replies, int *source_p,
- gf_boolean_t *flag);
+ unsigned char *flag);
int
afr_selfheal_unlocked_inspect(call_frame_t *frame, xlator_t *this, uuid_t gfid,
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index 6252f91736a..cc4bceef521 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -39,6 +39,10 @@
#define AFR_TA_DOM_MODIFY "afr.ta.dom-modify"
#define AFR_HALO_MAX_LATENCY 99999
+
+#define PFLAG_PENDING (1 << 0)
+#define PFLAG_SBRAIN (1 << 1)
+
typedef int (*afr_lock_cbk_t)(call_frame_t *frame, xlator_t *this);
typedef int (*afr_read_txn_wind_t)(call_frame_t *frame, xlator_t *this,