diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2015-01-05 16:21:52 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-01-08 21:55:37 -0800 |
commit | 70dc47389cbe08238d8c216c51d49583154bd08a (patch) | |
tree | f5da9dff6260291a7972e590d12ba785ed0841a1 /xlators/cluster/ec/src/ec-inode-read.c | |
parent | cf0770c61af2fa49fa435baf62cd5f28569175e4 (diff) |
cluster/ec: Handle internal xattr get/set
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.
Change-Id: I39cec96ae12826b506b496fda7da74201015fd75
BUG: 1178688
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/9385
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Emmanuel Dreyfus <manu@netbsd.org>
Tested-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
Diffstat (limited to 'xlators/cluster/ec/src/ec-inode-read.c')
-rw-r--r-- | xlators/cluster/ec/src/ec-inode-read.c | 50 |
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 3b5315b187a..64b1b719eea 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); } } |