diff options
author | Xavier Hernandez <xhernandez@datalab.es> | 2016-01-14 09:36:33 +0100 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-01-19 23:03:57 -0800 |
commit | 626534e94b4ac07b99a2cc479f004935664a09a2 (patch) | |
tree | 31227b36e272ccc7ce288ba1c28d1fb1f7627c18 /xlators/cluster | |
parent | 320f684a5eec9c6d39c674a93d48783301db5157 (diff) |
cluster/ec: Handle non-existent config xattr for non regular files
Since we now try to get the 'trusted.ec.config' xattr for inodes of
type IA_INVAL (these inodes will be set to some valid type later),
if that inode corresponds to a non regular file, the xattr won't
exist and we will handle this as an error when it's not.
This patch solves the problem by only considering errors for inodes
that are already known to be regular files.
> Change-Id: Id72f314e209459236d75cf087fc51e09943756b4
> BUG: 1293223
> Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
> Reviewed-on: http://review.gluster.org/13238
Change-Id: I48a475ce889607e9b909f699b5d7f75b0657cb22
BUG: 1293224
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/13239
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/ec/src/ec-common.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c index 3e05e0beb5d..bfb2294017d 100644 --- a/xlators/cluster/ec/src/ec-common.c +++ b/xlators/cluster/ec/src/ec-common.c @@ -897,7 +897,6 @@ ec_prepare_update_cbk (call_frame_t *frame, void *cookie, ec_lock_link_t *link = fop->data; ec_lock_t *lock = NULL; ec_inode_t *ctx; - ec_config_t config = {0,}; lock = link->lock; parent = link->fop; @@ -941,37 +940,40 @@ ec_prepare_update_cbk (call_frame_t *frame, void *cookie, lock->loc.inode->ia_type == IA_INVAL) { op_errno = -ec_dict_del_number(dict, EC_XATTR_SIZE, &ctx->pre_size); if (op_errno != 0) { - gf_msg (this->name, GF_LOG_ERROR, op_errno, - EC_MSG_SIZE_XATTR_GET_FAIL, "Unable to get size xattr"); + if (lock->loc.inode->ia_type == IA_IFREG) { + gf_msg (this->name, GF_LOG_ERROR, op_errno, + EC_MSG_SIZE_XATTR_GET_FAIL, + "Unable to get size xattr"); - goto unlock; - } - ctx->post_size = ctx->pre_size; + goto unlock; + } + } else { + ctx->post_size = ctx->pre_size; - ctx->have_size = _gf_true; + ctx->have_size = _gf_true; + } op_errno = -ec_dict_del_config(dict, EC_XATTR_CONFIG, &ctx->config); if (op_errno != 0) { - gf_msg (this->name, GF_LOG_ERROR, op_errno, - EC_MSG_CONFIG_XATTR_GET_FAIL, - "Unable to get config xattr"); - - goto unlock; - } - if (!(lock->loc.inode->ia_type == IA_INVAL && - !memcmp(&config, &ctx->config, sizeof(config)))) { + if (lock->loc.inode->ia_type == IA_IFREG) { + gf_msg (this->name, GF_LOG_ERROR, op_errno, + EC_MSG_CONFIG_XATTR_GET_FAIL, + "Unable to get config xattr"); - if (!ec_config_check(parent, &ctx->config)) { - gf_msg (this->name, GF_LOG_ERROR, EINVAL, - EC_MSG_CONFIG_XATTR_INVALID, - "Invalid config xattr"); + goto unlock; + } + } else { + if (!ec_config_check(parent, &ctx->config)) { + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + EC_MSG_CONFIG_XATTR_INVALID, + "Invalid config xattr"); - op_errno = EINVAL; + op_errno = EINVAL; - goto unlock; - } - ctx->have_config = _gf_true; + goto unlock; + } + ctx->have_config = _gf_true; } } |