Ditang Chen <[email protected]> says:
> I tested in Fedora20, when junction type is nfs-fedfs, the nfsref
> cannot resolve FSN if the export path is "/".
>
> # nfsref -d --type=nfs-fedfs add /.domainroot/example.net/s2 
> server2.example.net /
> ...
> nfsref: nsdb_normalize_path: result = '/'
> nfsref: nsdb_count_components: length = 4, count = 0, path = '/'
> nfsref: nsdb_alloc_zero_component_pathname: Zero-component pathname
> nfsref: nsdb_construct_nfsuri: NFS URI: nfs://Server2.example.net/
> ...
>
> # nfsref -d lookup s2/
> ..
> nfsref: nsdb_parse_nfs_uri: parsing 'nfs://server2.example.net/'
> nfsref: nsdb_uri_pathname_to_path_array: NFS URI has short pathname component
> nfsref: nsdb_resolve_fsn_parse_entry: parsing failed: FEDFS_ERR_BADNAME
> nfsref: nfsref_lookup_resolve_fsn: Failed to resolve FSN 
> 5f4bace9-14b3-4626-8d39-4b0
> ...

For a server pathname of "/", nsdb_construct_nfsuri() was
constructing an NFS URI with just a single terminating /, which is
incorrect according to section 2.8.1.2 of:

 http://datatracker.ietf.org/doc/draft-ietf-nfsv4-federated-fs-protocol/

Then "nfsref" is storing the incorrect URI in the NSDB.

Fixes: 750fdf4b (libnsdb: Add URI pathname parser helpers)
Reported-by: Ditang Chen <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
---
 src/libnsdb/path.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/libnsdb/path.c b/src/libnsdb/path.c
index 6bfea3a01ea3..1c7d007ca760 100644
--- a/src/libnsdb/path.c
+++ b/src/libnsdb/path.c
@@ -668,6 +668,15 @@ nsdb_path_array_to_uri_pathname(char * const *path_array, 
UriUriA *uri)
                return FEDFS_ERR_SVRFAULT;
        result = pos;
 
+       /* Zero-component pathname? */
+       if (path_array[0] == NULL) {
+               pos->next = nsdb_new_uri_path_segment("");
+               if (pos->next == NULL) {
+                       status = FEDFS_ERR_SVRFAULT;
+                       goto out_err;
+               }
+       }
+
        length = 0;
        for (i = 0; path_array[i] != NULL; i++) {
                component = path_array[i];


_______________________________________________
fedfs-utils-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/fedfs-utils-devel

Reply via email to