summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2016-01-14 09:36:33 +0100
committerJeff Darcy <jdarcy@redhat.com>2016-02-05 07:02:00 -0800
commit0aba36ab99fbf537ba2e5ceddfc950528506011f (patch)
tree0334024b87ab41f8a240824c7432b67e4f71b854 /xlators/cluster
parent4bde0b3db0e1f8fcbc782e29be2f2eb9e6d4c2fd (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 Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Ashish Pandey <aspandey@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/ec/src/ec-common.c48
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 82939f4c1c3..c8d1a3710ad 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;
}
}