diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2019-08-09 12:06:43 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2019-08-19 08:56:04 -0400 |
commit | 7e10cc25bfa0dd3602bbcf5cc9c759a90eb675dc (patch) | |
tree | ec18c6b86e2723378237c7be8f3b624de2623d85 | |
parent | d1abaeb3be7b5fa6d7a1fbbd2e14e3310005c4c1 (diff) |
NFS: Don't refresh attributes with mounted-on-file information
If we've been given the attributes of the mounted-on-file, then do not
use those to check or update the attributes on the application-visible
inode.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-rw-r--r-- | fs/nfs/inode.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 8a1758200b57..c764cfe456e5 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -1403,12 +1403,21 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat | |||
1403 | if (NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) | 1403 | if (NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) |
1404 | return 0; | 1404 | return 0; |
1405 | 1405 | ||
1406 | /* No fileid? Just exit */ | ||
1407 | if (!(fattr->valid & NFS_ATTR_FATTR_FILEID)) | ||
1408 | return 0; | ||
1406 | /* Has the inode gone and changed behind our back? */ | 1409 | /* Has the inode gone and changed behind our back? */ |
1407 | if ((fattr->valid & NFS_ATTR_FATTR_FILEID) && nfsi->fileid != fattr->fileid) | 1410 | if (nfsi->fileid != fattr->fileid) { |
1411 | /* Is this perhaps the mounted-on fileid? */ | ||
1412 | if ((fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) && | ||
1413 | nfsi->fileid == fattr->mounted_on_fileid) | ||
1414 | return 0; | ||
1408 | return -ESTALE; | 1415 | return -ESTALE; |
1416 | } | ||
1409 | if ((fattr->valid & NFS_ATTR_FATTR_TYPE) && (inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT)) | 1417 | if ((fattr->valid & NFS_ATTR_FATTR_TYPE) && (inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT)) |
1410 | return -ESTALE; | 1418 | return -ESTALE; |
1411 | 1419 | ||
1420 | |||
1412 | if (!nfs_file_has_buffered_writers(nfsi)) { | 1421 | if (!nfs_file_has_buffered_writers(nfsi)) { |
1413 | /* Verify a few of the more important attributes */ | 1422 | /* Verify a few of the more important attributes */ |
1414 | if ((fattr->valid & NFS_ATTR_FATTR_CHANGE) != 0 && !inode_eq_iversion_raw(inode, fattr->change_attr)) | 1423 | if ((fattr->valid & NFS_ATTR_FATTR_CHANGE) != 0 && !inode_eq_iversion_raw(inode, fattr->change_attr)) |
@@ -1768,18 +1777,6 @@ int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fa | |||
1768 | EXPORT_SYMBOL_GPL(nfs_post_op_update_inode_force_wcc); | 1777 | EXPORT_SYMBOL_GPL(nfs_post_op_update_inode_force_wcc); |
1769 | 1778 | ||
1770 | 1779 | ||
1771 | static inline bool nfs_fileid_valid(struct nfs_inode *nfsi, | ||
1772 | struct nfs_fattr *fattr) | ||
1773 | { | ||
1774 | bool ret1 = true, ret2 = true; | ||
1775 | |||
1776 | if (fattr->valid & NFS_ATTR_FATTR_FILEID) | ||
1777 | ret1 = (nfsi->fileid == fattr->fileid); | ||
1778 | if (fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) | ||
1779 | ret2 = (nfsi->fileid == fattr->mounted_on_fileid); | ||
1780 | return ret1 || ret2; | ||
1781 | } | ||
1782 | |||
1783 | /* | 1780 | /* |
1784 | * Many nfs protocol calls return the new file attributes after | 1781 | * Many nfs protocol calls return the new file attributes after |
1785 | * an operation. Here we update the inode to reflect the state | 1782 | * an operation. Here we update the inode to reflect the state |
@@ -1810,7 +1807,15 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1810 | nfs_display_fhandle_hash(NFS_FH(inode)), | 1807 | nfs_display_fhandle_hash(NFS_FH(inode)), |
1811 | atomic_read(&inode->i_count), fattr->valid); | 1808 | atomic_read(&inode->i_count), fattr->valid); |
1812 | 1809 | ||
1813 | if (!nfs_fileid_valid(nfsi, fattr)) { | 1810 | /* No fileid? Just exit */ |
1811 | if (!(fattr->valid & NFS_ATTR_FATTR_FILEID)) | ||
1812 | return 0; | ||
1813 | /* Has the inode gone and changed behind our back? */ | ||
1814 | if (nfsi->fileid != fattr->fileid) { | ||
1815 | /* Is this perhaps the mounted-on fileid? */ | ||
1816 | if ((fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) && | ||
1817 | nfsi->fileid == fattr->mounted_on_fileid) | ||
1818 | return 0; | ||
1814 | printk(KERN_ERR "NFS: server %s error: fileid changed\n" | 1819 | printk(KERN_ERR "NFS: server %s error: fileid changed\n" |
1815 | "fsid %s: expected fileid 0x%Lx, got 0x%Lx\n", | 1820 | "fsid %s: expected fileid 0x%Lx, got 0x%Lx\n", |
1816 | NFS_SERVER(inode)->nfs_client->cl_hostname, | 1821 | NFS_SERVER(inode)->nfs_client->cl_hostname, |