From 317eea0e182f45c0ccd14b1e83c832ba435ee283 Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Sat, 12 Dec 2015 11:49:20 +0530 Subject: afr: handle bad objects during lookup/inode_refresh Backport of http://review.gluster.org/12955, http://review.gluster.org/#/c/13077/ and http://review.gluster.org/#/c/13185/ If an object (file) is marked bad by bitrot, do not consider the brick on which the object is present as a potential read subvolume for AFR irrespective of the pending xattr values. Also do not consider the brick containing the bad object while performing afr_accuse_smallfiles(). Otherwise if the bad object's size is bigger,we may end up considering that as the source. Change-Id: I4abc68e51e5c43c5adfa56e1c00b46db22c88cf7 BUG: 1293300 Signed-off-by: Ravishankar N Reviewed-on: http://review.gluster.org/13041 Reviewed-by: Pranith Kumar Karampuri Tested-by: Pranith Kumar Karampuri NetBSD-regression: NetBSD Build System Smoke: Gluster Build System CentOS-regression: Gluster Build System --- xlators/cluster/afr/src/afr-common.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 474ab9b5020..e457dbce73c 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -642,6 +642,9 @@ afr_accuse_smallfiles (xlator_t *this, struct afr_reply *replies, priv = this->private; for (i = 0; i < priv->child_count; i++) { + if (replies[i].valid && replies[i].xdata && + dict_get (replies[i].xdata, GLUSTERFS_BAD_INODE)) + continue; if (data_accused[i]) continue; if (replies[i].poststat.ia_size > maxsize) @@ -703,6 +706,13 @@ afr_replies_interpret (call_frame_t *frame, xlator_t *this, inode_t *inode) continue; } + if (replies[i].xdata && + dict_get (replies[i].xdata, GLUSTERFS_BAD_INODE)) { + data_readable[i] = 0; + metadata_readable[i] = 0; + continue; + } + afr_accused_fill (this, replies[i].xdata, data_accused, (replies[i].poststat.ia_type == IA_IFDIR) ? AFR_ENTRY_TRANSACTION : AFR_DATA_TRANSACTION); @@ -861,7 +871,8 @@ afr_inode_refresh_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->replies[call_child].poststat = *buf; if (par) local->replies[call_child].postparent = *par; - local->replies[call_child].xdata = dict_ref (xdata); + if (xdata) + local->replies[call_child].xdata = dict_ref (xdata); } if (xdata) { ret = dict_get_int8 (xdata, "link-count", &need_heal); -- cgit