From 786343abca3474ff01aa1017210112d97cbc4843 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 4 Sep 2017 16:57:25 +0530 Subject: cluster/afr: Fail open on split-brain Problem: Append on a file with split-brain succeeds. Open is intercepted by open-behind, when write comes on the file, open-behind does open+write. Open succeeds because afr doesn't fail it. Then write succeeds because write-behind intercepts it. Flush is also intercepted by write-behind, so the application never gets to know that the write failed. Fix: Fail open on split-brain, so that when open-behind does open+write open fails which leads to write failure. Application will know about this failure. Change-Id: I4bff1c747c97bb2925d6987f4ced5f1ce75dbc15 BUG: 1294051 Signed-off-by: Pranith Kumar K --- xlators/cluster/afr/src/afr-self-heald.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'xlators/cluster/afr/src/afr-self-heald.c') diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 74c9bb67931..19cde88a6d5 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -260,7 +260,7 @@ afr_shd_zero_xattrop (xlator_t *this, uuid_t gfid) int raw[AFR_NUM_CHANGE_LOGS] = {0}; priv = this->private; - frame = afr_frame_create (this); + frame = afr_frame_create (this, NULL); if (!frame) goto out; inode = afr_inode_find (this, gfid); @@ -457,9 +457,9 @@ afr_shd_index_sweep (struct subvol_healer *healer, char *vgfid) priv = healer->this->private; subvol = priv->children[healer->subvol]; - frame = afr_frame_create (healer->this); + frame = afr_frame_create (healer->this, &ret); if (!frame) { - ret = -ENOMEM; + ret = -ret; goto out; } -- cgit