From 5c8ee98a2dc6e7754ad37adcfd3a0e04014f266c Mon Sep 17 00:00:00 2001 From: vmallika Date: Thu, 30 Apr 2015 16:28:27 +0530 Subject: quota: Validate NULL inode from the entries received in readdirp_cbk This is a backport of http://review.gluster.org/#/c/10416/ > In quota readdirp_cbk, inode ctx filled for the all entries > received. > In marker readdirp_cbk, files/directories are inspected for > dirty > There is no guarantee that entry->inode is populated. > If entry->inode is NULL, this needs to be treated as readdir > > Change-Id: Id2d17bb89e4770845ce1f13d73abc2b3c5826c06 > BUG: 1215550 > Signed-off-by: vmallika > Reviewed-on: http://review.gluster.org/10416 > Tested-by: NetBSD Build System > Tested-by: Gluster Build System > Reviewed-by: Raghavendra G > Tested-by: Raghavendra G Change-Id: If6578984ab1a33a3bdbaf0ec169f7c9548991144 BUG: 1217433 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/10472 Tested-by: Gluster Build System Reviewed-by: Niels de Vos --- xlators/features/marker/src/marker.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'xlators/features/marker/src') diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index 40777d57ab2..ead4779df91 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -2749,8 +2749,13 @@ marker_build_ancestry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, parent = NULL; } - ret = marker_inode_loc_fill (entry->inode, - entry->d_name, &loc); + if (parent) { + ret = marker_inode_loc_fill (parent, + entry->d_name, &loc); + } else { + ret = marker_inode_loc_fill (entry->inode, NULL, &loc); + } + if (ret) { gf_log (this->name, GF_LOG_WARNING, "Couldn't build " "loc for %s/%s", @@ -2797,8 +2802,9 @@ marker_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } list_for_each_entry (entry, &entries->list, list) { - if ((strcmp (entry->d_name, ".") == 0) || - (strcmp (entry->d_name, "..") == 0)) + if ((strcmp (entry->d_name, ".") == 0) || + (strcmp (entry->d_name, "..") == 0) || + entry->inode == NULL) continue; loc.parent = inode_ref (local->loc.inode); -- cgit