diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2017-01-10 13:26:02 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2017-01-11 22:42:02 -0800 |
commit | 5b24934668adb89e1dcd3888ac19555056508f06 (patch) | |
tree | 4ba29cac7df7b8a930a8ba9a42c2e888988d8164 /xlators/cluster/afr/src/afr-read-txn.c | |
parent | bb438d849a4a3941c1a9b525213f695f0a2c961b (diff) |
cluster/afr: Do not log of split-brain when there isn't one
* Even on errors like ENOENT, AFR logs split-brain after
read-txn refresh, introduced by commit a07ddd8f.
This can be a cause of much panic and confusion and needs to be fixed.
* Also fixed this issue in write-txns.
* Fixed afr read txns to log about split-brain only after knowing that
there is no split-brain choice configured.
* Removed code duplication
* Fixed incorrect passing of error code in afr_write_txn_refresh_done()
(the function was passing -0 as errno to gf_msg().
Change-Id: I354f454ce5bf0e5f00bc27916eb597367cb7d927
BUG: 1411625
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/16362
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-read-txn.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-read-txn.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/xlators/cluster/afr/src/afr-read-txn.c b/xlators/cluster/afr/src/afr-read-txn.c index deb74445a55..7591b128578 100644 --- a/xlators/cluster/afr/src/afr-read-txn.c +++ b/xlators/cluster/afr/src/afr-read-txn.c @@ -48,17 +48,6 @@ afr_read_txn_next_subvol (call_frame_t *frame, xlator_t *this) return 0; } -#define AFR_READ_TXN_SET_ERROR_AND_GOTO(ret, errnum, index, label) \ - do { \ - local->op_ret = ret; \ - local->op_errno = errnum; \ - read_subvol = index; \ - gf_msg (this->name, GF_LOG_ERROR, EIO, AFR_MSG_SPLIT_BRAIN,\ - "Failing %s on gfid %s: split-brain observed.",\ - gf_fop_list[local->op], uuid_utoa (inode->gfid));\ - goto label; \ - } while (0) - int afr_read_txn_refresh_done (call_frame_t *frame, xlator_t *this, int err) { @@ -72,19 +61,16 @@ afr_read_txn_refresh_done (call_frame_t *frame, xlator_t *this, int err) inode = local->inode; if (err) { - local->op_errno = -err; - local->op_ret = -1; read_subvol = -1; - gf_msg (this->name, GF_LOG_ERROR, EIO, AFR_MSG_SPLIT_BRAIN, - "Failing %s on gfid %s: split-brain observed.", - gf_fop_list[local->op], uuid_utoa (inode->gfid)); goto readfn; } read_subvol = afr_read_subvol_select_by_policy (inode, this, local->readable, NULL); - if (read_subvol == -1) - AFR_READ_TXN_SET_ERROR_AND_GOTO (-1, EIO, -1, readfn); + if (read_subvol == -1) { + err = -EIO; + goto readfn; + } if (local->read_attempted[read_subvol]) { afr_read_txn_next_subvol (frame, this); @@ -99,6 +85,10 @@ readfn: if ((ret == 0) && spb_choice >= 0) read_subvol = spb_choice; } + + if (read_subvol == -1) { + AFR_SET_ERROR_AND_CHECK_SPLIT_BRAIN (-1, -err); + } local->readfn (frame, this, read_subvol); return 0; |