Bug 873816

Summary: NFSv4 referrals fail if NFS server returns hostnames rather than IP addresses (Kernel part)
Product: Red Hat Enterprise Linux 6 Reporter: Steve Dickson <steved>
Component: kernelAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Petr Beňas <pbenas>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: chuck.lever, eguan, pbenas, pstehlik, rwheeler
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kernel-2.6.32-340.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 869400 Environment:
Last Closed: 2013-02-21 06:55:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 869400    
Bug Blocks:    

Description Steve Dickson 2012-11-06 19:01:17 UTC
+++ This bug was initially created as a clone of Bug #869400 +++

Description of problem:
NFS client in EL6 cannot follow NFSv4 referrals that contain hostnames rather than IP addresses.  "cd" into a referred-to directory fails, usually with Permission Denied.

Version-Release number of selected component (if applicable):
nfs-utils-1.2.3-26.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Set up an NFSv4 referral on an NFSv4 server specifying a hostname and export path
2. Mount the server and export containing the referral
3. On the client, cd into the NFS mount and then cd into the referred to directory
  
Actual results:
Permission denied or some other failure

Expected results:
The client should follow the referral, mount the referred to export, and allow the user to cd into that mounted export

Additional info:
One of two changes must be made.  Either:

 * 2.6.32.y kernel documentation supplies a simple script that must be installed under /usr/sbin/nfs_cache_getent, or

 * EL6 kernels must be built with CONFIG_NFS_USE_LEGACY_DNS=n, which should enable in-kernel DNS resolution

--- Additional comment from pm-rhel on 2012-10-23 15:23:52 EDT ---

Since this bug report was entered in bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

--- Additional comment from chuck.lever on 2012-10-24 11:06:42 EDT ---

Correction: the script is /sbin/nfs_cache_getent, not /usr/sbin/nfs_cache_getent.

Following an NFSv4 referral containing a hostname location FAILS on kernel 2.6.32-279.9.1.el6.x86_64, even with the /sbin/nfs_cache_getent script installed.  I confirmed the CONFIG_NFS_USE_LEGACY_DNS is set to "y" in this kernel's config.

--- Additional comment from chuck.lever on 2012-10-29 17:44:22 EDT ---

I used "git bisect" to find the point at which legacy DNS resolution starts failing.  It is this commit (just before 2.6.37):

commit c5b29f885afe890f953f7f23424045cdad31d3e4
Author: NeilBrown <neilb>
Date:   Thu Aug 12 16:55:22 2010 +1000

    sunrpc: use seconds since boot in expiry cache
    
    This protects us from confusion when the wallclock time changes.
    
    We convert to and from wallclock when  setting or reading expiry
    times.
    
    Also use seconds since boot for last_clost time.
    
    Signed-off-by: NeilBrown <neilb>
    Signed-off-by: J. Bruce Fields <bfields>

Neil has proposed a fix, which I've tested.  I will post a commit ID here when the fix is merged upstream.

--- Additional comment from chuck.lever on 2012-10-29 17:51:13 EDT ---

Let me recommend a way to test NFSv4 referral support.  For EL6:

  1.  Set up a Linux NFS server with NFSv4.0 support enabled

  2.  Create several "refer=" exports (see exports(5)) in an exported directory

     -  One refers to a working NFS export by hostname

     -  One refers to a working NFS export by hostname (which has IPv4 and IPv6 addresses)

     -  One refers to a working NFS export by a raw IPv4 address

     -  One refers to a working NFS export by a raw IPv6 address

     -  One refers to an export on an NFS server that is not available

  3.  Mount the exported directory via NFSv4.0 on the client under test

  4.  "cd" and "ls" commands should cause a successful submount in all but the final case

--- Additional comment from chuck.lever on 2012-11-05 17:17:20 EST ---

As of v3.7-rc4, the Linus tree has a commit to address the regression.  The commit is 8d96b10639fb4023 "NFS: fix bug in legacy DNS resolver."

As a test, I've built and installed 2.6.32-279 with this fix applied, and NFSv4 referrals work as expected.

GregKH reports he has applied this fix to stable trees 3.6.y, 3.4.y, and 3.0.y.

Comment 2 Steve Dickson 2012-11-06 19:05:24 UTC
The needed upstream patches

commit 8e282d7f891d1c83439f548589d109dbbe2ec082
Author: J. Bruce Fields <bfields>
Date:   Tue Jun 12 16:54:16 2012 -0400

    nfsd: add get_uint for u32's

and 

commit e2f4ada967ab3703df2d466938966ba1ab274658
Author: NeilBrown <neilb>
Date:   Wed Oct 31 12:16:01 2012 +1100

    NFS: fix bug in legacy DNS resolver.

Comment 3 RHEL Program Management 2012-11-06 19:21:05 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 7 Jarod Wilson 2012-11-12 18:22:17 UTC
Patch(es) available on kernel-2.6.32-340.el6

Comment 11 Petr Beňas 2012-11-21 16:49:51 UTC
Reproduced in 2.6.32-339.el6.x86_64 and verified in 2.6.32-340.el6.x86_64.

Comment 13 errata-xmlrpc 2013-02-21 06:55:41 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0496.html