From becdb76238c45ebe3edc967376f4aee87c0cb6e3 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Sun, 21 Dec 2014 22:01:03 +0530 Subject: features/marker: do not call inode_path on the inode not yet linked * in readdirp callbak marker is calling inode_path on the inodes that are not yet linked to the inode table. Change-Id: I7f5db29c6a7e778272044f60f8e73c60574df3a9 BUG: 1176393 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.org/9320 Tested-by: Gluster Build System Reviewed-by: Raghavendra G Tested-by: Raghavendra G --- xlators/features/marker/src/marker.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'xlators/features') diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index dcbbbd49190..ad3aabda9ba 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -2774,6 +2774,7 @@ marker_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, marker_local_t *local = NULL; loc_t loc = {0, }; int ret = -1; + char *resolvedpath = NULL; if (op_ret <= 0) goto unwind; @@ -2790,19 +2791,30 @@ marker_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, (strcmp (entry->d_name, "..") == 0)) continue; - ret = marker_inode_loc_fill (entry->inode, - entry->d_name, &loc); - if (ret) { - gf_log (this->name, GF_LOG_WARNING, "Couldn't build " - "loc for %s/%s", - uuid_utoa (local->loc.inode->gfid), - entry->d_name); + loc.parent = inode_ref (local->loc.inode); + loc.inode = inode_ref (entry->inode); + ret = inode_path (loc.parent, entry->d_name, &resolvedpath); + if (ret < 0) { + gf_log (this->name, GF_LOG_ERROR, "failed to get the " + "path for the entry %s", entry->d_name); + loc_wipe (&loc); + continue; + } + + loc.path = gf_strdup (resolvedpath); + if (!loc.path) { + gf_log (this->name, GF_LOG_ERROR, "strdup of path " + "failed for the entry %s (path: %s)", + entry->d_name, resolvedpath); + loc_wipe (&loc); continue; } mq_xattr_state (this, &loc, entry->dict, entry->d_stat); loc_wipe (&loc); + GF_FREE (resolvedpath); + resolvedpath = NULL; } unwind: -- cgit