summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2015-12-30 15:25:30 +0530
committerVenky Shankar <vshankar@redhat.com>2016-01-27 03:46:01 -0800
commit62dd323759fe2e9f45980835d97567ad8a4c371a (patch)
tree6828f530ef5c9858feb363ec911763ae33053a45 /xlators/features
parent0bfb02e3b56abf411882f245655921a91df885ef (diff)
features/bitrot: Fail node-uuid getxattr if file is marked bad
If xattr is node-uuid and the inode is marked bad, fail getxattr and fgetxattr with EIO. Returning EIO would result in AFR to choose correct node-uuid coresponding to the subvolume where the good copy of the file resides. BUG: 1296795 Change-Id: I3f8dc807794f9a82867807e7c4c73ded6c64fd8a Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/13116 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.org/13194 Tested-by: Venky Shankar <vshankar@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/bit-rot/src/stub/bit-rot-stub.c22
1 files changed, 22 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 5b2d5d70698..1ec9d459845 100644
--- a/xlators/features/bit-rot/src/stub/bit-rot-stub.c
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
@@ -1608,6 +1608,17 @@ br_stub_getxattr (call_frame_t *frame, xlator_t *this,
goto wind;
}
+ /**
+ * If xattr is node-uuid and the inode is marked bad, return EIO.
+ * Returning EIO would result in AFR to choose correct node-uuid
+ * coresponding to the subvolume * where the good copy of the
+ * file resides.
+ */
+ if (IA_ISREG (loc->inode->ia_type) && XATTR_IS_NODE_UUID (name) &&
+ br_stub_check_bad_object (this, loc->inode, &op_ret, &op_errno)) {
+ goto unwind;
+ }
+
if (br_stub_is_internal_xattr (name))
goto unwind;
@@ -1671,6 +1682,17 @@ br_stub_fgetxattr (call_frame_t *frame, xlator_t *this,
goto wind;
}
+ /**
+ * If xattr is node-uuid and the inode is marked bad, return EIO.
+ * Returning EIO would result in AFR to choose correct node-uuid
+ * coresponding to the subvolume * where the good copy of the
+ * file resides.
+ */
+ if (IA_ISREG (fd->inode->ia_type) && XATTR_IS_NODE_UUID (name) &&
+ br_stub_check_bad_object (this, fd->inode, &op_ret, &op_errno)) {
+ goto unwind;
+ }
+
if (br_stub_is_internal_xattr (name))
goto unwind;