Skip to content

Referral

Philippe DENIEL edited this page Oct 30, 2012 · 2 revisions

Using NFSv4 referrals with NFS-GANESHA

NFSv4 referral is a NFSv4 specific mechanism that makes it possible for a server to redirect a client to another another as it crosses a directory. This is no "mount points within mount points" as you can make in NFSv3, the client is actually redirected to the new server and stop accessing the first one.

A small example: let be server A and server B, and imagine that B's IP address is 123.456.789.123 (OK, this is a dumb address, but this is an example). The client will access A, find a referral a be redirected to B.

B exports directories /export and /export/refer that are nfs-exported. From the mount point, this last directory is accessed as path (moutpoint)/refer

The server A exports /home . In A's namespace, we create a directory /home/ref/nfs_referral to be used a referral. We'll then setup nfs-ganesha so that, when directory nfs_referral is traversed, the client is directed to A:/refer transparently.

In nfs-ganesha's configuration file on server A, you must defined two different 'Export' block.

The first one in related to /home, it should contain this:

EXPORT
{

  # Export Id (mandatory)
  Export_Id = 1 ;

  # Exported path (mandatory)
  Path = "/home" ;

 # Pseudo path for NFSv4 export (mandatory)
  Pseudo = "/posix_fs";

(...)

}

Then we define a new Export block to setup the referral.

EXPORT
{

  # Export Id (mandatory)
  Export_Id = 2 ;

  # Exported path (mandatory)
  Path = "/home/ref/nfs_referral" ;
  Referral = "/posix_fs/nfs_referral:/[email protected]" ;
(...)
}

The argument Referral is to be explained a little bit. Its content is made of 3 part : (local pseudofs path):(remote path)@(server)

      • the 'local pseudofs path' is the full path to the referral directory in server A pseudofs, you have to consider the value of 'Pseudo' is the first Export block (or do 'mount -t nfs4 A:/ /mnt' do get the path to use)
      • the remote path is the path on B for the referral
      • the last part should contain the server IP address. The server hostname could be used as well, but at the time I am writting this, it seems like the NFSv4 client in the kernel as problems in resolving hostname, so the explicit use of the IP address is preferable.