summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-08-28 00:16:50 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-02 10:30:08 -0700
commit22e0167d054c6880a66d51a7d86695fe2dd97f44 (patch)
tree1f252a7fdcfe0454f5f1f2ea6a07550d7361262c /libglusterfsclient
parentd165f43bb127e2a055721aa7793743fd55e94ed3 (diff)
libglusterfsclient: Enhance VMP searching logic
Another attempt to enhance searching for VMP entries. There was a problem of returning the longest prefix match from all the VMPs without checking whether the number of matched components were same as the number of components in the candidate VMP. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 209 (VMP parsing through fstab has issues) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=209
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index d8236cf3f92..699cd38eb14 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -1428,8 +1428,9 @@ _libgf_vmp_search_entry (char *path, int searchtype)
}
list_for_each_entry(entry, &vmplist.list, list) {
+ vmpcompcount = libgf_count_path_components (entry->vmp);
matchcount = libgf_vmp_entry_match (entry, path);
- if (matchcount > maxcount) {
+ if ((matchcount > maxcount) && (matchcount == vmpcompcount)) {
maxcount = matchcount;
maxentry = entry;
}
@@ -1439,6 +1440,7 @@ _libgf_vmp_search_entry (char *path, int searchtype)
* match, this is used to check whether duplicate entries are present
* in the vmplist.
*/
+ vmpcompcount = 0;
if ((searchtype == LIBGF_VMP_EXACT) && (maxentry)) {
vmpcompcount = libgf_count_path_components (maxentry->vmp);
if (vmpcompcount != matchcount)