diff options
Diffstat (limited to 'xlators/cluster/dht/src')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 6 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-helper.c | 21 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-layout.c | 9 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-selfheal.c | 26 | ||||
-rw-r--r-- | xlators/cluster/dht/src/switch.c | 2 |
5 files changed, 54 insertions, 10 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index f59bc9667..cf4ec258d 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2010,6 +2010,12 @@ dht_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (dict_get (xattr, conf->xattr_name)) { dict_del (xattr, conf->xattr_name); } + + if (frame->root->pid >= 0 ) { + GF_REMOVE_INTERNAL_XATTR("trusted.glusterfs.quota*", xattr); + GF_REMOVE_INTERNAL_XATTR("trusted.pgfid*", xattr); + } + local->op_ret = 0; if (!local->xattr) { diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index 76bfbaedb..381643b22 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -747,8 +747,10 @@ dht_migration_complete_check_task (void *data) src_node = local->cached_subvol; - if (!local->loc.inode && !local->fd) + if (!local->loc.inode && !local->fd) { + local->op_errno = EINVAL; goto out; + } inode = (!local->fd) ? local->loc.inode : local->fd->inode; @@ -770,19 +772,23 @@ dht_migration_complete_check_task (void *data) if (ret) { if (!dht_inode_missing(-ret) || (!local->loc.inode)) { + local->op_errno = -ret; gf_log (this->name, GF_LOG_ERROR, "%s: failed to get the 'linkto' xattr %s", local->loc.path, strerror (-ret)); ret = -1; goto out; } + /* Need to do lookup on hashed subvol, then get the file */ ret = syncop_lookup (this, &local->loc, NULL, &stbuf, NULL, NULL); if (ret) { + local->op_errno = -ret; ret = -1; goto out; } + dst_node = dht_subvol_get_cached (this, local->loc.inode); } @@ -791,17 +797,20 @@ dht_migration_complete_check_task (void *data) "%s: failed to get the destination node", local->loc.path); ret = -1; + local->op_errno = EINVAL; goto out; } /* lookup on dst */ if (local->loc.inode) { - ret = syncop_lookup (dst_node, &local->loc, NULL, &stbuf, NULL, NULL); + ret = syncop_lookup (dst_node, &local->loc, NULL, &stbuf, NULL, + NULL); if (ret) { gf_log (this->name, GF_LOG_ERROR, "%s: failed to lookup the file on %s", local->loc.path, dst_node->name); + local->op_errno = -ret; ret = -1; goto out; } @@ -811,6 +820,7 @@ dht_migration_complete_check_task (void *data) "%s: gfid different on the target file on %s", local->loc.path, dst_node->name); ret = -1; + local->op_errno = EIO; goto out; } } @@ -824,6 +834,7 @@ dht_migration_complete_check_task (void *data) "%s: could not set preset layout for subvol %s", local->loc.path, dst_node->name); ret = -1; + local->op_errno = EINVAL; goto out; } @@ -833,6 +844,7 @@ dht_migration_complete_check_task (void *data) "%s: no pre-set layout for subvolume %s", local->loc.path, dst_node ? dst_node->name : "<nil>"); ret = -1; + local->op_errno = EINVAL; goto out; } @@ -841,6 +853,7 @@ dht_migration_complete_check_task (void *data) gf_log (this->name, GF_LOG_ERROR, "%s: failed to set the new layout", local->loc.path); + local->op_errno = EINVAL; goto out; } @@ -877,13 +890,15 @@ dht_migration_complete_check_task (void *data) gf_log (this->name, GF_LOG_ERROR, "failed to open " "the fd (%p, flags=0%o) on file %s @ %s", iter_fd, iter_fd->flags, path, dst_node->name); - ret = -1; open_failed = 1; + local->op_errno = -ret; + ret = -1; } } GF_FREE (path); SYNCTASK_SETID (frame->root->uid, frame->root->gid); + if (open_failed) { ret = -1; goto out; diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c index f7413c8a0..1e38d6be1 100644 --- a/xlators/cluster/dht/src/dht-layout.c +++ b/xlators/cluster/dht/src/dht-layout.c @@ -443,8 +443,13 @@ dht_is_subvol_in_layout (dht_layout_t *layout, xlator_t *xlator) int i = 0; for (i = 0; i < layout->cnt; i++) { - if (!strcmp (layout->list[i].xlator->name, xlator->name)) - return _gf_true; + /* Check if xlator is already part of layout, and layout is + * non-zero. */ + if (!strcmp (layout->list[i].xlator->name, xlator->name)) { + if (layout->list[i].start != layout->list[i].stop) + return _gf_true; + break; + } } return _gf_false; } diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index 06fa1ed3a..0e6527544 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -127,6 +127,7 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc, int32_t *disk_layout = NULL; dht_local_t *local = NULL; dht_conf_t *conf = NULL; + data_t *data = NULL; local = frame->local; if (req_subvol) @@ -171,7 +172,16 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc, layout->type, subvol->name, loc->path); dict_ref (xattr); - + if (local->xattr) { + data = dict_get (local->xattr, QUOTA_LIMIT_KEY); + if (data) { + ret = dict_add (xattr, QUOTA_LIMIT_KEY, data); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, "Failed to " + "set quota limit key on %s",loc->path); + } + } + } if (!uuid_is_null (local->gfid)) uuid_copy (loc->gfid, local->gfid); @@ -265,7 +275,14 @@ dht_selfheal_dir_xattr (call_frame_t *frame, loc_t *loc, dht_layout_t *layout) } missing_xattr++; } - + /* Also account for subvolumes with no-layout. Used for zero'ing out + * the layouts and for setting quota key's if present */ + for (i = 0; i < conf->subvolume_cnt; i++) { + if (_gf_false == + dht_is_subvol_in_layout (layout, conf->subvolumes[i])) { + missing_xattr++; + } + } gf_log (this->name, GF_LOG_TRACE, "%d subvolumes missing xattr for %s", missing_xattr, loc->path); @@ -276,7 +293,6 @@ dht_selfheal_dir_xattr (call_frame_t *frame, loc_t *loc, dht_layout_t *layout) } local->call_cnt = missing_xattr; - for (i = 0; i < layout->cnt; i++) { if (layout->list[i].err != -1 || !layout->list[i].stop) continue; @@ -289,13 +305,15 @@ dht_selfheal_dir_xattr (call_frame_t *frame, loc_t *loc, dht_layout_t *layout) dummy = dht_layout_new (this, 1); if (!dummy) goto out; - for (i = 0; i < conf->subvolume_cnt; i++) { + for (i = 0; i < conf->subvolume_cnt && missing_xattr; i++) { if (_gf_false == dht_is_subvol_in_layout (layout, conf->subvolumes[i])) { dht_selfheal_dir_xattr_persubvol (frame, loc, dummy, 0, conf->subvolumes[i]); + missing_xattr--; } } + dht_layout_unref (this, dummy); out: return 0; diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c index d3ea90ba8..2717ce975 100644 --- a/xlators/cluster/dht/src/switch.c +++ b/xlators/cluster/dht/src/switch.c @@ -670,6 +670,7 @@ set_switch_pattern (xlator_t *this, dht_conf_t *conf, GF_FREE (dup_str); continue; } + GF_FREE (dup_str); memcpy (switch_opt->path_pattern, pattern, strlen (pattern)); if (childs) { dup_childs = gf_strdup (childs); @@ -726,7 +727,6 @@ set_switch_pattern (xlator_t *this, dht_conf_t *conf, "option in unify volume. Exiting"); goto err; } - GF_FREE (dup_str); /* Link it to the main structure */ if (switch_buf) { |