summaryrefslogtreecommitdiffstats
path: root/xlators/features/bit-rot
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2015-12-12 11:49:20 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-01-21 21:28:34 -0800
commit317eea0e182f45c0ccd14b1e83c832ba435ee283 (patch)
tree1bb840216193235f167af5b518466ab2541e3a9b /xlators/features/bit-rot
parentaabbb0a1c1f65b34d05ce5e2a49ecc5c1c5e738f (diff)
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 <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/13041 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/features/bit-rot')
-rw-r--r--xlators/features/bit-rot/src/stub/bit-rot-stub.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.c b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
index bbb2c92acf3..d082817c67e 100644
--- a/xlators/features/bit-rot/src/stub/bit-rot-stub.c
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
@@ -2768,6 +2768,62 @@ br_stub_lookup (call_frame_t *frame,
/** {{{ */
+/* fstat() */
+int br_stub_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *buf,
+ dict_t *xdata)
+{
+
+ int ret = 0;
+ br_stub_local_t *local = NULL;
+ inode_t *inode = NULL;
+
+ local = frame->local;
+ frame->local = NULL;
+ inode = local->u.context.inode;
+
+ ret = br_stub_mark_xdata_bad_object (this, inode, xdata);
+ if (ret) {
+ op_ret = -1;
+ op_errno = EIO;
+ }
+
+ br_stub_cleanup_local(local);
+ br_stub_dealloc_local(local);
+ STACK_UNWIND_STRICT (fstat, frame, op_ret, op_errno, buf, xdata);
+ return 0;
+}
+
+int
+br_stub_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
+{
+ br_stub_local_t *local = NULL;
+ int32_t op_ret = -1;
+ int32_t op_errno = EINVAL;
+
+ local = br_stub_alloc_local (this);
+ if (!local) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ br_stub_fill_local (local, NULL, fd, fd->inode, fd->inode->gfid,
+ BR_STUB_NO_VERSIONING, 0);
+ frame->local = local;
+
+ STACK_WIND (frame, br_stub_fstat_cbk, FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->fstat, fd, xdata);
+ return 0;
+unwind:
+ STACK_UNWIND_STRICT (fstat, frame, op_ret, op_errno, NULL, NULL);
+ return 0;
+}
+
+/** }}} */
+
+/** {{{ */
+
/* forget() */
int
@@ -3042,6 +3098,7 @@ unblock:
struct xlator_fops fops = {
.lookup = br_stub_lookup,
+ .fstat = br_stub_fstat,
.open = br_stub_open,
.create = br_stub_create,
.readdirp = br_stub_readdirp,