summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix.c
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2016-01-14 17:14:25 +0530
committerAravinda VK <avishwan@redhat.com>2016-03-07 02:24:18 -0800
commitfda9270c906d955f735b0fc0f85818a435325f87 (patch)
tree5a2d94ec21ec8941d4f35fead5e819bfad544184 /xlators/storage/posix/src/posix.c
parent10e091508ca6e5af815fce612be48287d354a01b (diff)
geo-rep: Mask xtime and stime xattrs
Allow access to xtime and stime xattrs only to gsyncd client and mask them for the rest. This is to prevent afr from performing self healing on marker xtime and geo-rep stime xattr which is not expected as each of which gets updated them from backend brick and should not be healed. BUG: 1313623 Change-Id: I9b4b3ce30bbc09d300e6d5c6782e2446f2411c6f Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/13242 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.org/13572 Reviewed-by: Aravinda VK <avishwan@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r--xlators/storage/posix/src/posix.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 433b5a41dc8..761bc4e5946 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -4047,6 +4047,14 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
op_ret = -1;
priv = this->private;
+ /* Allow access to stime xattr only to geo-rep worker */
+ if (frame->root->pid != GF_CLIENT_PID_GSYNCD && name &&
+ fnmatch ("*.glusterfs.*.stime", name, FNM_PERIOD) == 0) {
+ op_ret = -1;
+ op_errno = ENOATTR;
+ goto out;
+ }
+
if (loc->inode && IA_ISDIR(loc->inode->ia_type) && name &&
ZR_FILE_CONTENT_REQUEST(name)) {
ret = posix_get_file_contents (this, loc->gfid, &name[15],
@@ -4356,6 +4364,10 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
list_offset = 0;
while (remaining_size > 0) {
strcpy (keybuffer, list + list_offset);
+ if (frame->root->pid != GF_CLIENT_PID_GSYNCD &&
+ fnmatch ("*.glusterfs.*.stime", keybuffer, FNM_PERIOD) == 0)
+ goto ignore;
+
size = sys_lgetxattr (real_path, keybuffer, NULL, 0);
if (size == -1) {
op_ret = -1;
@@ -4403,6 +4415,7 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
goto out;
}
+ignore:
remaining_size -= strlen (keybuffer) + 1;
list_offset += strlen (keybuffer) + 1;