diff options
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/marker/src/marker.c | 38 | ||||
-rw-r--r-- | xlators/features/quota/src/quota.c | 51 |
2 files changed, 46 insertions, 43 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index 48a275e2783..f4fdf2e415b 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -2982,38 +2982,17 @@ marker_build_ancestry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, gf_dirent_t *entries, dict_t *xdata) { - gf_dirent_t *entry = NULL; - loc_t loc = {0, }; - inode_t *parent = NULL; - int ret = -1; + gf_dirent_t *entry = NULL; + quota_inode_ctx_t *ctx = NULL; + int ret = -1; if ((op_ret <= 0) || (entries == NULL)) { goto out; } list_for_each_entry (entry, &entries->list, list) { - if (entry->inode == entry->inode->table->root) { - inode_unref (parent); - parent = NULL; - } - - if (parent) - _marker_inode_loc_fill (entry->inode, parent, - entry->d_name, &loc); - else - ret = marker_inode_loc_fill (entry->inode, &loc); - - if (ret) { - gf_log (this->name, GF_LOG_WARNING, "Couldn't build " - "loc for %s/%s", - parent? uuid_utoa (parent->gfid): NULL, - entry->d_name); + if (entry->inode == NULL) continue; - } - - inode_unref (parent); - parent = inode_ref (entry->inode); - loc_wipe (&loc); ret = marker_key_set_ver (this, entry->dict); if (ret < 0) { @@ -3021,10 +3000,13 @@ marker_build_ancestry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_errno = ENOMEM; break; } - } - if (parent) - inode_unref (parent); + ctx = mq_inode_ctx_new (entry->inode, this); + if (ctx == NULL) + gf_log (this->name, GF_LOG_WARNING, "mq_inode_ctx_new " + "failed for %s", + uuid_utoa (entry->inode->gfid)); + } out: STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, entries, xdata); diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 105d70cbea6..847c93f37c0 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -737,13 +737,17 @@ quota_build_ancestry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, dict_t *xdata) { - inode_t *parent = NULL, *tmp_parent = NULL; - gf_dirent_t *entry = NULL; - loc_t loc = {0, }; - quota_dentry_t *dentry = NULL, *tmp = NULL; - quota_inode_ctx_t *ctx = NULL; - struct list_head parents = {0, }; - quota_local_t *local = NULL; + inode_t *parent = NULL; + inode_t *tmp_parent = NULL; + inode_t *linked_inode = NULL; + inode_t *tmp_inode = NULL; + gf_dirent_t *entry = NULL; + loc_t loc = {0, }; + quota_dentry_t *dentry = NULL; + quota_dentry_t *tmp = NULL; + quota_inode_ctx_t *ctx = NULL; + struct list_head parents = {0, }; + quota_local_t *local = NULL; INIT_LIST_HEAD (&parents); @@ -753,14 +757,6 @@ quota_build_ancestry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret < 0) goto err; - parent = inode_parent (local->loc.inode, 0, NULL); - if (parent == NULL) { - gf_msg (this->name, GF_LOG_WARNING, EINVAL, - Q_MSG_PARENT_NULL, "parent is NULL"); - op_errno = EINVAL; - goto err; - } - if ((op_ret > 0) && (entries != NULL)) { list_for_each_entry (entry, &entries->list, list) { if (__is_root_gfid (entry->inode->gfid)) { @@ -776,6 +772,23 @@ quota_build_ancestry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ tmp_parent = NULL; + } else { + /* For a non-root entry, link this inode */ + linked_inode = inode_link (entry->inode, + tmp_parent, + entry->d_name, + &entry->d_stat); + if (linked_inode) { + tmp_inode = entry->inode; + entry->inode = linked_inode; + inode_unref (tmp_inode); + } else { + gf_msg (this->name, GF_LOG_WARNING, + EINVAL, Q_MSG_PARENT_NULL, + "inode link failed"); + op_errno = EINVAL; + goto err; + } } gf_uuid_copy (loc.gfid, entry->d_stat.ia_gfid); @@ -793,6 +806,14 @@ quota_build_ancestry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } + parent = inode_parent (local->loc.inode, 0, NULL); + if (parent == NULL) { + gf_msg (this->name, GF_LOG_WARNING, EINVAL, + Q_MSG_PARENT_NULL, "parent is NULL"); + op_errno = EINVAL; + goto err; + } + quota_inode_ctx_get (local->loc.inode, this, &ctx, 0); quota_add_parents_from_ctx (ctx, &parents); |