[fedfs-utils] [PATCH 4/9] libnsdb: NFS URI is incorrect when storing FSLs in NSDBs
Chuck Lever
chuck.lever at oracle.com
Fri Jun 27 11:42:45 PDT 2014
Ditang Chen <chendt.fnst at cn.fujitsu.com> 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 <chendt.fnst at cn.fujitsu.com>
Signed-off-by: Chuck Lever <chuck.lever at oracle.com>
---
src/libnsdb/path.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/libnsdb/path.c b/src/libnsdb/path.c
index c58dc8979848..298a029ba561 100644
--- a/src/libnsdb/path.c
+++ b/src/libnsdb/path.c
@@ -635,6 +635,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];
More information about the fedfs-utils-devel
mailing list