I use scp to copy some files to a XFS local partition on a file server host and create a symbolic link to new deployed files locally though SSH. That partition is exported through NFS and mounted on several hosts.
scp new-file-version fileserver:/nfs/exported/path
ssh fileserver ln -s new-file-version /nfs/exported/path/file
If I check for the deployed files and symbolic link locally in the file server everything is fine:
fileserver$ ls -l /nfs/exported/path
lrwxrwxrwx 1 root root 56 Oct 30 12:30 file -> new-file-version
-rwxr-xr-x 11 root root 220 Oct 30 12:34 new-file-version
-rwxr-xr-x 11 root root 220 Oct 30 12:12 previous-file-version
But when I try to see the deployed files or copy them through NFS I get several some Input/output error in the just created symbolic links:
nfsclient$ ls -l /nfs/mounted/path
ls: cannot read symbolic link /nfs/mounted/path/file: Input/output error
lrwxrwxrwx 1 root root 56 Oct 30 12:30 file
-rwxr-xr-x 11 root root 220 Oct 30 12:34 new-file-version
-rwxr-xr-x 11 root root 220 Oct 30 12:12 previous-file-version
The stat command on the NFS mounted path reports this info:
nfsclient$ stat /nfs/mounted/path
File: '/nfs/mounted/path'
Size: 175 Blocks: 0 IO Block: 32768 directory
Device: 2ch/44d Inode: 560507638 Links: 3
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-11-02 14:25:04.677606317 +0100
Modify: 2018-11-02 14:25:28.630755680 +0100
Change: 2018-11-02 14:25:28.630755680 +0100
Birth: -
Notice that the access time is previous to the modify/change time, in spite of that I have just read the directory contents.
If I retry the operation, it will finally succeed after some attempts:
nfsclient$ ls -l /nfs/mounted/path
lrwxrwxrwx 1 root root 56 Oct 30 12:30 file -> new-file-version
-rwxr-xr-x 11 root root 220 Oct 30 12:34 new-file-version
-rwxr-xr-x 11 root root 220 Oct 30 12:12 previous-file-version
And then stat reports this information with the access time updated:
nfsclient$ stat /nfs/mounted/path
File: '/nfs/mounted/path'
Size: 175 Blocks: 0 IO Block: 32768 directory
Device: 2ch/44d Inode: 560507638 Links: 3
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-11-02 14:25:30.925774294 +0100
Modify: 2018-11-02 14:25:28.630755680 +0100
Change: 2018-11-02 14:25:28.630755680 +0100
Birth: -
Any clue on why is this happenning?
stat
against the directory containing the symlink target or the directory containing the symling itself at various points (before symlink creation, before the first ls, after the error goes away). You'll probably see an old (cached) directory being used for a while until it expires from the attribute cache.