summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec/src/ec-inode-read.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2015-01-05 16:21:52 +0530
committerRaghavendra Bhat <raghavendra@redhat.com>2015-02-04 03:53:33 -0800
commit92ab560f73299a1d5faf43a1a90516baa2ba275b (patch)
treed3340584d65067a5dd01a8538ab0d1ee9fd79170 /xlators/cluster/ec/src/ec-inode-read.c
parentf397d7edb85c1e4b78c4cac176dc8a0afe8cf9a8 (diff)
cluster/ec: Handle internal xattr get/set
Backport of http://review.gluster.org/9385 Problem: Internal xattrs of EC like trusted.ec.size/config/version can be modified by users and that can lead to misbehavior in EC. Fix: Don't let the user modify the xattrs. Hide these xattrs in getfattr outputs. BUG: 1182490 Change-Id: Ie32ebb95ee67cabbb9488951097a517172b45bcf Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/9455 Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-inode-read.c')
-rw-r--r--xlators/cluster/ec/src/ec-inode-read.c50
1 files changed, 21 insertions, 29 deletions
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c
index b79fbed7e5b..a962264fde9 100644
--- a/xlators/cluster/ec/src/ec-inode-read.c
+++ b/xlators/cluster/ec/src/ec-inode-read.c
@@ -280,15 +280,10 @@ int32_t ec_manager_getxattr(ec_fop_data_t * fop, int32_t state)
else
{
if (cbk->xdata != NULL)
- {
- dict_del(cbk->xdata, EC_XATTR_SIZE);
- dict_del(cbk->xdata, EC_XATTR_VERSION);
- }
+ ec_filter_internal_xattrs (cbk->xdata);
+
if (cbk->dict != NULL)
- {
- dict_del(cbk->dict, EC_XATTR_SIZE);
- dict_del(cbk->dict, EC_XATTR_VERSION);
- }
+ ec_filter_internal_xattrs (cbk->dict);
}
}
else
@@ -399,9 +394,10 @@ out:
return 0;
}
-void ec_getxattr(call_frame_t * frame, xlator_t * this, uintptr_t target,
- int32_t minimum, fop_getxattr_cbk_t func, void * data,
- loc_t * loc, const char * name, dict_t * xdata)
+void
+ec_getxattr (call_frame_t *frame, xlator_t *this, uintptr_t target,
+ int32_t minimum, fop_getxattr_cbk_t func, void *data,
+ loc_t *loc, const char *name, dict_t *xdata)
{
ec_cbk_t callback = { .getxattr = func };
ec_fop_data_t * fop = NULL;
@@ -464,13 +460,10 @@ void ec_getxattr(call_frame_t * frame, xlator_t * this, uintptr_t target,
error = 0;
out:
- if (fop != NULL)
- {
- ec_manager(fop, error);
- }
- else
- {
- func(frame, NULL, this, -1, EIO, NULL, NULL);
+ if (fop != NULL) {
+ ec_manager (fop, error);
+ } else {
+ func (frame, NULL, this, -1, error, NULL, NULL);
}
}
@@ -536,7 +529,8 @@ out:
return 0;
}
-void ec_wind_fgetxattr(ec_t * ec, ec_fop_data_t * fop, int32_t idx)
+void
+ec_wind_fgetxattr (ec_t *ec, ec_fop_data_t *fop, int32_t idx)
{
ec_trace("WIND", fop, "idx=%d", idx);
@@ -545,9 +539,10 @@ void ec_wind_fgetxattr(ec_t * ec, ec_fop_data_t * fop, int32_t idx)
fop->fd, fop->str[0], fop->xdata);
}
-void ec_fgetxattr(call_frame_t * frame, xlator_t * this, uintptr_t target,
- int32_t minimum, fop_fgetxattr_cbk_t func, void * data,
- fd_t * fd, const char * name, dict_t * xdata)
+void
+ec_fgetxattr (call_frame_t *frame, xlator_t *this, uintptr_t target,
+ int32_t minimum, fop_fgetxattr_cbk_t func, void *data,
+ fd_t *fd, const char *name, dict_t *xdata)
{
ec_cbk_t callback = { .fgetxattr = func };
ec_fop_data_t * fop = NULL;
@@ -606,13 +601,10 @@ void ec_fgetxattr(call_frame_t * frame, xlator_t * this, uintptr_t target,
error = 0;
out:
- if (fop != NULL)
- {
- ec_manager(fop, error);
- }
- else
- {
- func(frame, NULL, this, -1, EIO, NULL, NULL);
+ if (fop != NULL) {
+ ec_manager (fop, error);
+ } else {
+ func (frame, NULL, this, -1, error, NULL, NULL);
}
}