diff options
author | vmallika <vmallika@redhat.com> | 2015-04-30 16:15:06 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendra@redhat.com> | 2015-05-21 02:17:54 -0700 |
commit | bfd7f71be79458f88777bc388d965e9c28b51435 (patch) | |
tree | be7dedf3e87a11543d1367c672f423ef360c445d | |
parent | 24b3db07685fcc39f08e15b1b5e5cd1262b91590 (diff) |
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 <vmallika@redhat.com>
> Reviewed-on: http://review.gluster.org/10416
> Tested-by: NetBSD Build System
> 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: Iace5a53efac58ab5a0a82bcfddfff6fb2a5b5068
BUG: 1217423
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/10470
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
-rw-r--r-- | xlators/features/marker/src/marker.c | 14 | ||||
-rw-r--r-- | xlators/features/quota/src/quota.c | 5 |
2 files changed, 13 insertions, 6 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index e9c80440a5e..1814cdc8f8e 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -2738,8 +2738,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", @@ -2786,8 +2791,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); diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index b4ea013fbcd..e3ed48bd8cc 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -3987,8 +3987,9 @@ quota_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; 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; uuid_copy (loc.gfid, entry->d_stat.ia_gfid); |