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-write.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-write.c')
-rw-r--r-- | xlators/cluster/ec/src/ec-inode-write.c | 97 |
1 files changed, 45 insertions, 52 deletions
diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c index c120f067b6a..9c3f6fcd115 100644 --- a/xlators/cluster/ec/src/ec-inode-write.c +++ b/xlators/cluster/ec/src/ec-inode-write.c @@ -195,9 +195,10 @@ int32_t ec_manager_removexattr(ec_fop_data_t * fop, int32_t state) } } -void ec_removexattr(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_removexattr_cbk_t func, void * data, - loc_t * loc, const char * name, dict_t * xdata) +void +ec_removexattr (call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_removexattr_cbk_t func, void *data, + loc_t *loc, const char *name, dict_t *xdata) { ec_cbk_t callback = { .removexattr = func }; ec_fop_data_t * fop = NULL; @@ -205,9 +206,9 @@ void ec_removexattr(call_frame_t * frame, xlator_t * this, uintptr_t target, gf_log("ec", GF_LOG_TRACE, "EC(REMOVEXATTR) %p", frame); - VALIDATE_OR_GOTO(this, out); - GF_VALIDATE_OR_GOTO(this->name, frame, out); - GF_VALIDATE_OR_GOTO(this->name, this->private, out); + VALIDATE_OR_GOTO (this, out); + GF_VALIDATE_OR_GOTO (this->name, frame, out); + GF_VALIDATE_OR_GOTO (this->name, this->private, out); fop = ec_fop_data_allocate(frame, this, GF_FOP_REMOVEXATTR, EC_FLAG_UPDATE_LOC_INODE, target, minimum, @@ -252,13 +253,10 @@ void ec_removexattr(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); + if (fop != NULL) { + ec_manager (fop, error); + } else { + func (frame, NULL, this, -1, error, NULL); } } @@ -319,9 +317,10 @@ void ec_wind_fremovexattr(ec_t * ec, ec_fop_data_t * fop, int32_t idx) fop->fd, fop->str[0], fop->xdata); } -void ec_fremovexattr(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_fremovexattr_cbk_t func, void * data, - fd_t * fd, const char * name, dict_t * xdata) +void +ec_fremovexattr (call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_fremovexattr_cbk_t func, void *data, + fd_t *fd, const char *name, dict_t *xdata) { ec_cbk_t callback = { .fremovexattr = func }; ec_fop_data_t * fop = NULL; @@ -329,9 +328,9 @@ void ec_fremovexattr(call_frame_t * frame, xlator_t * this, uintptr_t target, gf_log("ec", GF_LOG_TRACE, "EC(FREMOVEXATTR) %p", frame); - VALIDATE_OR_GOTO(this, out); - GF_VALIDATE_OR_GOTO(this->name, frame, out); - GF_VALIDATE_OR_GOTO(this->name, this->private, out); + VALIDATE_OR_GOTO (this, out); + GF_VALIDATE_OR_GOTO (this->name, frame, out); + GF_VALIDATE_OR_GOTO (this->name, this->private, out); fop = ec_fop_data_allocate(frame, this, GF_FOP_FREMOVEXATTR, EC_FLAG_UPDATE_FD_INODE, target, minimum, @@ -380,13 +379,10 @@ void ec_fremovexattr(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); + if (fop != NULL) { + ec_manager (fop, error); + } else { + func (frame, NULL, this, -1, error, NULL); } } @@ -986,9 +982,10 @@ int32_t ec_manager_setxattr(ec_fop_data_t * fop, int32_t state) } } -void ec_setxattr(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_setxattr_cbk_t func, void * data, - loc_t * loc, dict_t * dict, int32_t flags, dict_t * xdata) +void +ec_setxattr (call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_setxattr_cbk_t func, void *data, + loc_t *loc, dict_t *dict, int32_t flags, dict_t *xdata) { ec_cbk_t callback = { .setxattr = func }; ec_fop_data_t * fop = NULL; @@ -1046,29 +1043,27 @@ void ec_setxattr(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); + if (fop != NULL) { + ec_manager (fop, error); + } else { + func (frame, NULL, this, -1, error, NULL); } } /* FOP: fsetxattr */ -int32_t ec_fsetxattr_cbk(call_frame_t * frame, void * cookie, xlator_t * this, - int32_t op_ret, int32_t op_errno, dict_t * xdata) +int32_t +ec_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata) { ec_fop_data_t * fop = NULL; ec_cbk_data_t * cbk = NULL; int32_t idx = (int32_t)(uintptr_t)cookie; - VALIDATE_OR_GOTO(this, out); - GF_VALIDATE_OR_GOTO(this->name, frame, out); - GF_VALIDATE_OR_GOTO(this->name, frame->local, out); - GF_VALIDATE_OR_GOTO(this->name, this->private, out); + VALIDATE_OR_GOTO (this, out); + GF_VALIDATE_OR_GOTO (this->name, frame, out); + GF_VALIDATE_OR_GOTO (this->name, frame->local, out); + GF_VALIDATE_OR_GOTO (this->name, this->private, out); fop = frame->local; @@ -1112,9 +1107,10 @@ void ec_wind_fsetxattr(ec_t * ec, ec_fop_data_t * fop, int32_t idx) fop->fd, fop->dict, fop->int32, fop->xdata); } -void ec_fsetxattr(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_fsetxattr_cbk_t func, void * data, - fd_t * fd, dict_t * dict, int32_t flags, dict_t * xdata) +void +ec_fsetxattr (call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_fsetxattr_cbk_t func, void *data, + fd_t *fd, dict_t *dict, int32_t flags, dict_t *xdata) { ec_cbk_t callback = { .fsetxattr = func }; ec_fop_data_t * fop = NULL; @@ -1176,13 +1172,10 @@ void ec_fsetxattr(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); + if (fop != NULL) { + ec_manager (fop, error); + } else { + func (frame, NULL, this, -1, error, NULL); } } |