From a41f212e4b5bf74e2752370de10b754a1fa3f675 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Thu, 12 Jun 2014 20:14:33 +0530 Subject: get the path from the loc->path in the lookup instead of resolver doing it Change-Id: I7448e1199f4fd32fb0ae127b36dcf06641a153a9 BUG: 1108887 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.org/8053 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- .../features/snapview-server/src/snapview-server.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'xlators/features/snapview-server') diff --git a/xlators/features/snapview-server/src/snapview-server.c b/xlators/features/snapview-server/src/snapview-server.c index 6ef0e7ad2d8..188aff1fbd7 100644 --- a/xlators/features/snapview-server/src/snapview-server.c +++ b/xlators/features/snapview-server/src/snapview-server.c @@ -970,7 +970,25 @@ svs_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) private = this->private; - if (loc->name) { + /* For lookups sent on inodes (i.e not parent inode + basename, but + direct inode itself which usually is a nameless lookup or revalidate + on the inode), loc->name will not be there. Get it from path if + it is there. + This is the difference between nameless lookup and revalidate lookup + on an inode: + nameless lookup: loc->path contains gfid and strrchr on it fails + revalidate lookup: loc->path contains the entry name of the inode + and strrchr gives the name of the entry from path + */ + if (loc->path) { + if (!loc->name || (loc->name && !strcmp (loc->name, ""))) { + loc->name = strrchr (loc->path, '/'); + if (loc->name) + loc->name++; + } + } + + if (loc->name && strlen (loc->name)) { ret = dict_get_str_boolean (xdata, "entry-point", _gf_false); if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, "failed to get the " -- cgit