From 028afb21a7793d3efbb9db431bde37ec332d9839 Mon Sep 17 00:00:00 2001 From: vmallika Date: Sun, 27 Mar 2016 11:01:34 +0530 Subject: storage/posix: send proper iatt attributes for the root inode This is a backport of http://review.gluster.org/13730 * changes in posix to send proper iatt attributes for the root directory when ancestry is built. Before posix was filling only the gfid and the inode type in the iatt structure keeping rest of the fields zeros. This was cached by posix-acl and used to send EACCES when some fops came on that object if the uid of the caller is same as the uid of the object on the disk. * getting and setting inode_ctx in function 'posix_acl_ctx_get' is not atomic and can lead to memory leak when there are multiple lookups for an inode at same time. This patch fixes this problem * Linking an inode in posix_build_ancestry, can cause a race in posix_acl. When parent inode is linked in posix_build_ancestry, and before it reaches posix_acl_readdirp_cbk, create/lookup can come on a leaf-inode, as parent-inode-ctx not yet updated in posix_acl_readdirp_cbk, create/lookup can fail with EACCESS. So do the inode linking in the quota xlator > Change-Id: I3101eefb65551cc4162c4ff2963be1b73deacd6d > BUG: 1320818 > Signed-off-by: Raghavendra Bhat > Reviewed-on: http://review.gluster.org/13730 > Tested-by: Vijaikumar Mallikarjuna > Smoke: Gluster Build System > NetBSD-regression: NetBSD Build System > CentOS-regression: Gluster Build System > Reviewed-by: Raghavendra G Change-Id: I65b0bbf83e563b519db07f2bcddcc6465743b6ea BUG: 1320892 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/13825 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Niels de Vos Reviewed-by: Raghavendra G --- xlators/features/marker/src/marker.c | 38 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'xlators/features/marker') diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index a48218083d6..e731f19d350 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -2984,38 +2984,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) { @@ -3023,10 +3002,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); -- cgit