Thursday May 03, 2007

This is my first attempt at a blog and I didn't have a great deal to say about me so I figured I go with what I've been working on lately. As for a bit about me, up until recently I've been a member of the NFS group working on automounter improvements and more recently an NFSv4 referrals prototype which we tested at this years connectathon.

As part of the NFSv4 referrals work we saw a need to be able to resolve a host name to it's netbuf address. To do that I came up with the following design ideas:

As part of fs_locations, it is possible for the referring server to return ip addresses (IPv4 or IPv6) as well as FDQN for the referred-to server(s). However, in constructing the mounta arguments an ip address must be used to describe the server. So, if an FQDN was returned for the referred-to server(s), we need to first resolve it to an ip address. The functionality that determines if we have a host name or an ip adress in fs_locations will be the same as what is currently used in the automounter.

To be able to access the host indicated in fs_locations we need to be able to call up into user space to get a netbuf structure; this will do name to address resolution for names and will also handle locations expressed as dotted-quad numeric addresses. To do this we will create a new daemon that will be passed the locations information from the kernel through an upcall and will return the netbuf containing the server address as well as the knetconfig structure. This daemon will set up a door and it's door handle will be placed into the nfs per-zone global data structure through a call to nfssys. The door will have the function nfsref_doorfunc() associated with it. This function will in turn create the CLIENT and call get_nfs4ref_info which does the name to address resolution. In the kernel we'll pull the door handle from the global data structure, xdr encode the utf8 string containing the server name and pass that through the door up to the daemon. When the daemon receives this request nfsref_doorfunc is called and the utf8 string will be xdr decoded and passed to get_nfs4ref_info which then xdr encodes and passes back the netbuf and knetconfig structures.

The function get_nfs4ref_info and get_server_netinfo will be the entry points into a new library that contains the code that does the name resolution. The library functions that do this will be get_server_netinfo, get_netconfig_info and get_knconf. These will be static functions in the library and will be used by get_nfs4ref_info.

The automounter will be essentially the same with the exception that the address lookup calls and the portmap cache will be moved to the hostname to address resolution library. The current client creation from get_server_stuff() will be expected to be done outside of the library functions and the client will need to be passed in to the library calls. The function get_server_stuff() will be renamed to get_server_netinfo(), moved to the library and will retain the same functionality. However the call get_the_stuff() will be divided into two functions the first will be called get_netconfig_info and will comprise most of the current behavior from get_the_stuff(). The second function will be get_server_fh() and will remain in autod_nfs.c. This function will be the functionality associated with getting the server fh (type_of_stuff == SERVER_FH) and will comprise what is currently in get_the_stuff starting at line 2909 through 3083 in autod_nfs.c. The automounter will make use of this with the current call to get_server_stuff() but this will now be a wrapper for a call to the library call get_netconfig_info() followed by a local call to get_server_fh() giving us behavior similar to what is currently there. Also to be moved into the library is the call to get_knconf keeping it's current behavior that will give us the knconf structure to pass back from the upcall. The upcall will make use of the get_server_netinfo which will call get_netconf_info() and get_knconf().

New functions in the library:

fsl_info_t *get_nfs4ref_info(CLIENT *cl, char *hostname)  (called by the upcall)
netbuf *get_server_netinfo(
   CLIENT *cl,
   char *host,
   rpcprog_t prog,
   rpcprog_t vers,
   struct netconfig *nconf,
   ushort_t port,
   bool_t direct_to_server,
   enum clnt_stat *cstat); 
static netbuf *get_netconfig_info(
   CLIENT *cl,
   char *hostname,
   rpcprog_t prog,
   rpcprog_t vers,
   struct netconfig *nconf,
   ushort_t port,
   bool_t direct_to_server,
   enum clnt_stat *cstat)

New functions in autod_nfs.c:

get_server_fh(
   char *hostname,
   AUTH *ah,
   CLIENT *cl,
   rpcprog_t vers,
   struct snego_t *snego,
   mfs_snego_t *mfssnego,
   char *fspath,
   enum clnt_stat *cstat)

existing functions that will be moved from autod_nfs.c to the new library:

struct knetconfig *get_knconf(struct netconfig *);
get_cached_srv_addr()
portmap_cache_lookup()
portmap_cache_enter()

required from libnsl:

rpcb_getaddr()
setnetpath()
getnetpath()
endnetpath()
getnetconfigent()
netdir_getbyname()
netdir_options()
clnt_call()
authsys_create_default()

headers needed:

fcntl.h
sys/types.h
sys/stat.h
netconfig.h
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed