diff options
| author | Raghavendra Bhat <raghavendra@redhat.com> | 2014-06-12 20:14:33 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2014-06-13 09:54:43 -0700 | 
| commit | a41f212e4b5bf74e2752370de10b754a1fa3f675 (patch) | |
| tree | 982bbfee1a0b903a6f3c8f8ade0dd53da2edbc14 | |
| parent | a6585d9c5e536818e01f05df8e58c18bbe59e231 (diff) | |
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 <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/8053
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
| -rw-r--r-- | xlators/features/snapview-server/src/snapview-server.c | 20 | 
1 files changed, 19 insertions, 1 deletions
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 "  | 
