summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-08-28 00:14:38 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-02 10:30:29 -0700
commit21d3084bc6b0ce572fc4136446d45c8ac0f647f8 (patch)
tree61a3159c2b1e63e07db742cc57b3255bcc19a47a /libglusterfsclient
parent19de82a5caf0c6ec3ca09cb5b9a5f186fa9e78ee (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 6a4e137cf9b..e3fdbe4d460 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)