summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2015-01-30 11:40:17 +0530
committerNiels de Vos <ndevos@redhat.com>2015-02-05 07:17:24 -0800
commit0ee6628471c27e57577dbcf4e4823f0b0b526ae2 (patch)
tree1c5ba79b14052128dc36fdfe0950114d40aa6b21
parent4b3981d2c9b4cafa24398765b3d0c8a4d45d43b1 (diff)
features/marker: do not call inode_path on the inode not yet linked
This is a backport of http://review.gluster.org/#/c/9320 > * 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 <raghavendra@redhat.com> > Reviewed-on: http://review.gluster.org/9320 > Tested-by: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Raghavendra G <rgowdapp@redhat.com> > Tested-by: Raghavendra G <rgowdapp@redhat.com> Change-Id: I9e2c14d0e0dd52d01ff1dd65b0b50f83874eef0e BUG: 1174250 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/9508 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r--xlators/features/marker/src/marker.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
index ed0f9e8..8c3789f6 100644
--- a/xlators/features/marker/src/marker.c
+++ b/xlators/features/marker/src/marker.c
@@ -2722,11 +2722,12 @@ marker_readdirp_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;
- marker_conf_t *priv = NULL;
- marker_local_t *local = NULL;
- loc_t loc = {0, };
- int ret = -1;
+ gf_dirent_t *entry = NULL;
+ marker_conf_t *priv = NULL;
+ marker_local_t *local = NULL;
+ loc_t loc = {0, };
+ int ret = -1;
+ char *resolvedpath = NULL;
if (op_ret <= 0)
goto unwind;
@@ -2743,19 +2744,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, "Couln'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: