Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1416532 - Symlinks removed and replaced on an nfs mount from another system receive STALE nfs error and EIO from readlink()
Symlinks removed and replaced on an nfs mount from another system receive STA...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: kernel (Show other bugs)
7.3
Unspecified Unspecified
urgent Severity medium
: rc
: ---
Assigned To: Benjamin Coddington
Yin.JianHong
: Regression, ZStream
Depends On:
Blocks: 1429514
  Show dependency treegraph
 
Reported: 2017-01-25 13:03 EST by Frank Sorenson
Modified: 2017-08-02 01:10 EDT (History)
10 users (show)

See Also:
Fixed In Version: kernel-3.10.0-562.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1429514 (view as bug list)
Environment:
Last Closed: 2017-08-02 01:10:53 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test script (467 bytes, application/x-shellscript)
2017-01-25 13:17 EST, Frank Sorenson
no flags Details
packet capture from 3.10.0-514 kernel (5.89 KB, application/x-gzip)
2017-01-25 13:35 EST, Frank Sorenson
no flags Details
packet capture from 3.10.0-327 kernel (3.54 KB, application/x-gzip)
2017-01-25 13:48 EST, Frank Sorenson
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3000451 None None None 2017-04-12 11:18 EDT
Red Hat Product Errata RHSA-2017:1842 normal SHIPPED_LIVE Important: kernel security, bug fix, and enhancement update 2017-08-01 14:22:09 EDT

  None (edit)
Description Frank Sorenson 2017-01-25 13:03:28 EST
Description of problem:

After a symlink is removed and then re-created on the nfs server or on another client, the RHEL 7.3 nfs client's readlink call receives an NFSERR_STALE/NFS4ERR_STALE response, and returns EIO to userspace until acregmin has passed.

With the 7.2 or upstream kernels, the symlink is read as expected.


Version-Release number of selected component (if applicable):

nfs client running on kernel:
	3.10.0-327.10.1.el7.x86_64 - PASS
	3.10.0-514.el7.x86_64 - FAIL
	4.9.0-rc8+ - PASS


How reproducible:

easy, see below


Steps to Reproduce:
  on nfs server:
    mkdir -p /export/symlink_test
    cd /export/symlink_test
    touch test_file
    for i in $(seq 1 3) ; do ln -s test_file test_symlink-$i ; done

    export /export/symlink_test

  on nfs client:
    mkdir /mnt/symlink_test
    mount server:/export/symlink_test /mnt/symlink_test
    cd /mnt/symlink_test
    ls -li

  on nfs server:
    for i in $(seq 1 3) ; do rm -f test_symlink-$i ; ln -s test_file test_symlink-$i ; done

  on nfs client (within a second or two):
    ls -li


Actual results:
# ls -li
ls: cannot read symbolic link test_symlink-1: Input/output error
ls: cannot read symbolic link test_symlink-2: Input/output error
ls: cannot read symbolic link test_symlink-3: Input/output error
101373355 lrwxrwxrwx. 1 root root   9 Jan 25 11:45 test_symlink-1
101373362 lrwxrwxrwx. 1 root root   9 Jan 25 11:45 test_symlink-2
101373366 lrwxrwxrwx. 1 root root   9 Jan 25 11:45 test_symlink-3


Expected results:

101373324 -rw-r--r--. 4 root root   0 Jan 25 11:44 test_file
101373355 lrwxrwxrwx. 1 root root   9 Jan 25 11:44 test_symlink-1 -> test_file
101373362 lrwxrwxrwx. 1 root root   9 Jan 25 11:44 test_symlink-2 -> test_file
101373366 lrwxrwxrwx. 1 root root   9 Jan 25 11:44 test_symlink-3 -> test_file


Additional info:

The directory listing returns to correct/expected behavior after a time that appears to be acregmin.

more complete test script will be attached
Comment 1 Frank Sorenson 2017-01-25 13:17 EST
Created attachment 1244328 [details]
test script

the test script replaces symlinks, files, and directories, to see which result in EIO or other errors.  Only symlinks to files and symlinks to directories seem to be affected.
Comment 2 Frank Sorenson 2017-01-25 13:35 EST
Created attachment 1244355 [details]
packet capture from 3.10.0-514 kernel
Comment 3 Frank Sorenson 2017-01-25 13:48 EST
Created attachment 1244359 [details]
packet capture from 3.10.0-327 kernel
Comment 7 Benjamin Coddington 2017-01-26 13:04:40 EST
RedHat's backport of upstream commit
fa9233699cc1 NFS: Don't require a filehandle to refresh the inode in nfs_prime_dcache()

needs fixing up.  It changes nfs_same_file() to return true if (entry->fattr->fileid == nfsi->fileid) without comparing filehandles, in which case the existing dentry is updated instead of dropped in a READDIR.

The fix should be to take upstream
7dc72d5f7a0e NFS: Fix inode corruption in nfs_prime_dcache()

and I'd like to additionally take upstream
d8fdb47fae5f NFS: Don't let readdirplus revalidate an inode that was marked as stale
Comment 14 Rafael Aquini 2017-02-10 09:41:15 EST
Patch(es) committed on kernel repository and an interim kernel build is undergoing testing
Comment 16 Rafael Aquini 2017-02-13 07:19:14 EST
Patch(es) available on kernel-3.10.0-562.el7
Comment 20 Tim Speetjens 2017-02-15 09:10:09 EST
I found the reproducing steps somewhat unreliable, for what it's worth, this is how I did:

mount nfs filesystem on 2 nodes, inside commonly mounted dir

on node1 (which demonstrates the issue, later):

// setup
# touch test_file
# for i in $(seq 3); do ln -s test_file test_link_$i; done
// check
# ls -li

on node 2
# for i in $(seq 3); do rm -f test_link_$i; ln -s test_file test_link_$i; done

back on node1
# ln -s test_file test_here; rm -f test_here; ls -li
ls: cannot read symbolic link test_link_1: Input/output error
ls: cannot read symbolic link test_link_2: Input/output error
ls: cannot read symbolic link test_link_3: Input/output error
total 0
83861514 -rw-r--r--. 1 root root 0 Feb 15 14:08 test_file
83861515 lrwxrwxrwx. 1 root root 9 Feb 15 14:08 test_link_1
83861516 lrwxrwxrwx. 1 root root 9 Feb 15 14:08 test_link_2
83861517 lrwxrwxrwx. 1 root root 9 Feb 15 14:08 test_link_3
Comment 24 errata-xmlrpc 2017-08-02 01:10:53 EDT
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.

https://access.redhat.com/errata/RHSA-2017:1842

Note You need to log in before you can comment on or make changes to this bug.