The is_subdirectory() function checks if a given 'child' is a
subdirectory of the given 'parent'. However it always fails
if 'parent' == "/" (because 'child' doesn't begin with 'parent'
followed by "/").
So change is_subdirectory() to special-case "/".
subexport() also tests if one directory is a subdirectory of the
other, and contains the same bug. So change it to use
is_subdirectory().
Finally, move is_subdirectory() and related path_matches() and
export_matches() earlier in the file to avoid a forward-reference.
This patch fixes a bug wherein if you export "/" with 'crossmnt', the
crossmnt flag is ineffective and you can only access the root
filesystem, not any descendants.
Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>