From 698c0750e5b93fb9aa842a1d70def9ecfa6da41c Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Wed, 1 Feb 2012 22:35:55 +0530 Subject: performanc/stat-prefetch: check if loc->gfid is present before checking loc->name After gfid based backend changes loc will either contain the gfid of the inode or it will contain the parent gfid and the name of the entry. So before unwinding when loc->name is not there we have to check if loc->gfid is present or not. If loc->gfid is null and loc->name is also NULL, then unwind with the error. Change-Id: If88b9462bde09a80e79f27899c995605697ce453 BUG: 785675 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.com/2710 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Jeff Darcy Reviewed-by: Vijay Bellur --- xlators/performance/stat-prefetch/src/stat-prefetch.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index 827a9f99d28..a760e97a9a5 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -2189,9 +2189,11 @@ sp_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc) this, out); GF_VALIDATE_OR_GOTO (this->name, newloc, out); GF_VALIDATE_OR_GOTO (this->name, newloc->path, out); - GF_VALIDATE_OR_GOTO (this->name, newloc->name, out); + if (uuid_is_null (newloc->gfid)) + GF_VALIDATE_OR_GOTO (this->name, newloc->name, out); GF_VALIDATE_OR_GOTO (this->name, newloc->inode, out); - GF_VALIDATE_OR_GOTO (this->name, oldloc->name, out); + if (uuid_is_null (oldloc->gfid)) + GF_VALIDATE_OR_GOTO (this->name, oldloc->name, out); ret = sp_cache_remove_parent_entry (frame, this, newloc->parent->table, (char *)newloc->path); @@ -2292,7 +2294,8 @@ sp_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) GF_VALIDATE_OR_GOTO (frame->this ? frame->this->name : "stat-prefetch", this, out); GF_VALIDATE_OR_GOTO (this->name, loc, out); - GF_VALIDATE_OR_GOTO (this->name, loc->name, out); + if (uuid_is_null (loc->gfid)) + GF_VALIDATE_OR_GOTO (this->name, loc->name, out); sp_remove_caches_from_all_fds_opened (this, loc->parent, (char *)loc->name); @@ -2432,7 +2435,8 @@ sp_setattr (call_frame_t *frame, xlator_t *this, GF_VALIDATE_OR_GOTO (frame->this ? frame->this->name : "stat-prefetch", this, out); GF_VALIDATE_OR_GOTO (this->name, loc, out); - GF_VALIDATE_OR_GOTO (this->name, loc->name, out); + if (uuid_is_null (loc->gfid)) + GF_VALIDATE_OR_GOTO (this->name, loc->name, out); sp_remove_caches_from_all_fds_opened (this, loc->parent, (char *)loc->name); @@ -2531,7 +2535,8 @@ sp_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size) GF_ASSERT (frame); GF_VALIDATE_OR_GOTO ("stat-prefetch", this, out); GF_VALIDATE_OR_GOTO (this->name, loc, out); - GF_VALIDATE_OR_GOTO (this->name, loc->name, out); + if (uuid_is_null (loc->gfid)) + GF_VALIDATE_OR_GOTO (this->name, loc->name, out); sp_remove_caches_from_all_fds_opened (this, loc->parent, (char *)loc->name); -- cgit