Bug 1416532

Summary: Symlinks removed and replaced on an nfs mount from another system receive STALE nfs error and EIO from readlink()
Product: Red Hat Enterprise Linux 7 Reporter: Frank Sorenson <fsorenso>
Component: kernelAssignee: Benjamin Coddington <bcodding>
kernel sub component: NFS QA Contact: JianHong Yin <jiyin>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: urgent CC: bcodding, dhoward, dwysocha, eguan, jiyin, knweiss, mjtrangoni, nfs-maint, tspeetje, yoyang
Version: 7.3Keywords: Regression, ZStream
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 05:10:53 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:    
Bug Blocks: 1429514    
Attachments:
Description Flags
test script
none
packet capture from 3.10.0-514 kernel
none
packet capture from 3.10.0-327 kernel none

Description Frank Sorenson 2017-01-25 18:03:28 UTC
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 18:17:57 UTC
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 18:35:07 UTC
Created attachment 1244355 [details]
packet capture from 3.10.0-514 kernel

Comment 3 Frank Sorenson 2017-01-25 18:48:00 UTC
Created attachment 1244359 [details]
packet capture from 3.10.0-327 kernel

Comment 7 Benjamin Coddington 2017-01-26 18:04:40 UTC
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 14:41:15 UTC
Patch(es) committed on kernel repository and an interim kernel build is undergoing testing

Comment 16 Rafael Aquini 2017-02-13 12:19:14 UTC
Patch(es) available on kernel-3.10.0-562.el7

Comment 20 Tim Speetjens 2017-02-15 14:10:09 UTC
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 05:10:53 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.

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