FedFsNfsReferrals
From Linux NFS
Chucklever (Talk | contribs) (→New-style referral support) |
Chucklever (Talk | contribs) |
||
Line 21: | Line 21: | ||
Note that when a file server returns a location containing a DNS hostname, the client must resolve that to an IP address before it can mount a new server. Early NFSv4 referral support had no ability to resolve a hostname contained in a location. More recently, DNS resolution capability was added to the Linux NFS client. | Note that when a file server returns a location containing a DNS hostname, the client must resolve that to an IP address before it can mount a new server. Early NFSv4 referral support had no ability to resolve a hostname contained in a location. More recently, DNS resolution capability was added to the Linux NFS client. | ||
- | + | I've found that recent Fedora distributions (Fedora 16 and later) use new-style DNS resolution, and no further set-up is required. However, earlier distributions (even EL6-based ones) do need some attention in this area. The following steps may be required. | |
- | + | == Legacy kernel DNS resolution == | |
- | + | With kernels before 2.6.36, an upcall is needed to perform DNS resolution. The kernel executes the script /sbin/nfs_cache_getent to resolve a hostname. | |
- | + | If your Linux distributor doesn't provide this script, you can find it in the Linux kernel source contained in either Documentation/filesystems/nfs.txt or Documentation/filesystems/nfs/nfs.txt. Simply copy the file into /sbin/nfs_cache_getent, edit it to remove the instructions, and make the file executable. After the client is rebooted (or the NFS module is reloaded), NFSv4 referral locations containing hostnames should be handled correctly. | |
- | + | == New-style kernel DNS resolution == | |
- | With kernel 2.6.36 and following, the kernel NFS client can continue to use the upcall mechanism described above if the CONFIG_NFS_USE_LEGACY_DNS build option is set to Y. | + | With kernel 2.6.36 and following, the kernel NFS client can continue to use the upcall mechanism described above if the CONFIG_NFS_USE_LEGACY_DNS build option is set to Y. Y is the default setting. |
- | However, an in-kernel DNS resolver is used if this build option is set to N. In this case, no additional infrastructure is required. | + | However, an in-kernel DNS resolver is used if this build option is set to N. In this case, no additional infrastructure (including /sbin/nfs_cache_getent) is required. |
- | Typically your Linux distributor provides the build option settings used to compile their kernel in /boot/config-''foo'' (where ''foo'' is the kernel version). You can look in this file to see how your distributor has set the CONFIG_NFS_USE_LEGACY_DNS build option. | + | Typically your Linux distributor provides the build option settings used to compile their kernel in /boot/config-''foo'' (where ''foo'' is the kernel version). You can look in this file to see how your distributor has set the CONFIG_NFS_USE_LEGACY_DNS build option. Or, if you build your own kernel, ensure this option is set to N for your next kernel build. |
Revision as of 20:30, 17 October 2012
Contents |
Project: fedfs-utils
[ Project Home | News | Downloads | Docs | Mailing Lists | Source Control | Issues ]
Introduction
FedFS relies on existing support for referrals in standard network file system clients like the NFS or CIFS client built into Linux.
A referral is a file server response that tells a client to look elsewhere for the shared file system it wants. During a referral event, the file server provides a list of locations a client can try. Each location consists of an export path paired with a server hostname or IP address. A client can use any one of these pairs to mount the file system it is looking for.
When client NFSv4 support is enabled, NFSv4 referral support is enabled by default in all recent Linux kernel versions. When a referral is encountered, the Linux NFS client automatically retrieves a location list from the file server and attempts to mount each location in the list until one succeeds.
Note that when a file server returns a location containing a DNS hostname, the client must resolve that to an IP address before it can mount a new server. Early NFSv4 referral support had no ability to resolve a hostname contained in a location. More recently, DNS resolution capability was added to the Linux NFS client.
I've found that recent Fedora distributions (Fedora 16 and later) use new-style DNS resolution, and no further set-up is required. However, earlier distributions (even EL6-based ones) do need some attention in this area. The following steps may be required.
Legacy kernel DNS resolution
With kernels before 2.6.36, an upcall is needed to perform DNS resolution. The kernel executes the script /sbin/nfs_cache_getent to resolve a hostname.
If your Linux distributor doesn't provide this script, you can find it in the Linux kernel source contained in either Documentation/filesystems/nfs.txt or Documentation/filesystems/nfs/nfs.txt. Simply copy the file into /sbin/nfs_cache_getent, edit it to remove the instructions, and make the file executable. After the client is rebooted (or the NFS module is reloaded), NFSv4 referral locations containing hostnames should be handled correctly.
New-style kernel DNS resolution
With kernel 2.6.36 and following, the kernel NFS client can continue to use the upcall mechanism described above if the CONFIG_NFS_USE_LEGACY_DNS build option is set to Y. Y is the default setting.
However, an in-kernel DNS resolver is used if this build option is set to N. In this case, no additional infrastructure (including /sbin/nfs_cache_getent) is required.
Typically your Linux distributor provides the build option settings used to compile their kernel in /boot/config-foo (where foo is the kernel version). You can look in this file to see how your distributor has set the CONFIG_NFS_USE_LEGACY_DNS build option. Or, if you build your own kernel, ensure this option is set to N for your next kernel build.