summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2015-12-21 16:04:20 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-01-13 03:56:59 -0800
commit3882408103973eac6983c2efdd5af8b1d51f272c (patch)
treeea4cf65e1bc4264f192b3dc4e0d7aa3e5ecfe0fd /xlators/cluster/ec
parente9d20f0e1a17e0ef2f148a9b49d1cf9596cbe609 (diff)
cluster/ec: Get size and config for invalid inode
Problem: After creating an inode and before linking it to inode table, if there is a request to setattr for that file, it fails and leads to crash. Before linking inode to inode table ia_type is IA_INVAL which will casue have_size and have_config as zero. Solution: Check and get size and config if an inode is invalid Change-Id: I0c0e564940b1b9f351369a76ab14f6b4aa81f23b BUG: 1293223 Signed-off-by: Ashish Pandey <aspandey@redhat.com> Reviewed-on: http://review.gluster.org/13039 Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/ec')
-rw-r--r--xlators/cluster/ec/src/ec-common.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c
index ef43a30ac6e..82939f4c1c3 100644
--- a/xlators/cluster/ec/src/ec-common.c
+++ b/xlators/cluster/ec/src/ec-common.c
@@ -897,6 +897,7 @@ 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;
@@ -936,7 +937,8 @@ ec_prepare_update_cbk (call_frame_t *frame, void *cookie,
ctx->have_version = _gf_true;
- if (lock->loc.inode->ia_type == IA_IFREG) {
+ if (lock->loc.inode->ia_type == IA_IFREG ||
+ 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,
@@ -956,17 +958,21 @@ ec_prepare_update_cbk (call_frame_t *frame, void *cookie,
goto unlock;
}
- if (!ec_config_check(parent, &ctx->config)) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- EC_MSG_CONFIG_XATTR_INVALID,
- "Invalid config xattr");
+ if (!(lock->loc.inode->ia_type == IA_INVAL &&
+ !memcmp(&config, &ctx->config, sizeof(config)))) {
- op_errno = EINVAL;
+ 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;
- }
+ op_errno = EINVAL;
- ctx->have_config = _gf_true;
+ goto unlock;
+ }
+ ctx->have_config = _gf_true;
+
+ }
}
ctx->have_info = _gf_true;
@@ -1039,7 +1045,9 @@ void ec_get_size_version(ec_lock_link_t *link)
/* Determine if there's something we need to retrieve for the current
* operation. */
- if (!lock->query && (lock->loc.inode->ia_type != IA_IFREG)) {
+ if (!lock->query &&
+ (lock->loc.inode->ia_type != IA_IFREG) &&
+ (lock->loc.inode->ia_type != IA_INVAL)) {
return;
}
@@ -1080,7 +1088,8 @@ void ec_get_size_version(ec_lock_link_t *link)
goto out;
}
- if (lock->loc.inode->ia_type == IA_IFREG) {
+ if (lock->loc.inode->ia_type == IA_IFREG ||
+ lock->loc.inode->ia_type == IA_INVAL) {
error = ec_dict_set_number(dict, EC_XATTR_SIZE, 0);
if (error == 0) {
error = ec_dict_set_number(dict, EC_XATTR_CONFIG, 0);