Whamcloud - gitweb
LU-3023 build: fix fuzzy logic in get_root_path()
authorSebastien Buisson <sebastien.buisson@bull.net>
Mon, 25 Mar 2013 13:52:34 +0000 (14:52 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 3 May 2013 03:07:27 +0000 (23:07 -0400)
Thanks to the call to llapi_is_lustre_mnt(), we are sure that
mnt.mnt_fsname contains ":/".
And, if no other mountpoint is found (len ==0), there is no reason
to abort scanning, so the check and -EINVAL can just be removed.

Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Change-Id: Id77c41fbf53782d657034f152f724a3bdc83408c
Reviewed-on: http://review.whamcloud.com/5832
Reviewed-by: John Hammond <johnlockwoodhammond@gmail.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
lustre/utils/liblustreapi.c

index 6d0d385..5e76bca 100644 (file)
@@ -878,10 +878,11 @@ int get_root_path(int want, char *fsname, int *outfd, char *path, int index)
 
                 mntlen = strlen(mnt.mnt_dir);
                 ptr = strrchr(mnt.mnt_fsname, '/');
-                if (!ptr && !len) {
-                        rc = -EINVAL;
-                        break;
-                }
+               /* thanks to the call to llapi_is_lustre_mnt() above,
+                * we are sure that mnt.mnt_fsname contains ":/",
+                * so ptr should never be NULL */
+               if (ptr == NULL)
+                       continue;
                 ptr++;
 
                 /* Check the fsname for a match, if given */