@@ -1403,12 +1403,21 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat
1403
1403
if (NFS_PROTO (inode )-> have_delegation (inode , FMODE_READ ))
1404
1404
return 0 ;
1405
1405
1406
+ /* No fileid? Just exit */
1407
+ if (!(fattr -> valid & NFS_ATTR_FATTR_FILEID ))
1408
+ return 0 ;
1406
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
1415
return - ESTALE ;
1416
+ }
1409
1417
if ((fattr -> valid & NFS_ATTR_FATTR_TYPE ) && (inode -> i_mode & S_IFMT ) != (fattr -> mode & S_IFMT ))
1410
1418
return - ESTALE ;
1411
1419
1420
+
1412
1421
if (!nfs_file_has_buffered_writers (nfsi )) {
1413
1422
/* Verify a few of the more important attributes */
1414
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
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
1781
* Many nfs protocol calls return the new file attributes after
1785
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
1807
nfs_display_fhandle_hash (NFS_FH (inode )),
1811
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
1819
printk (KERN_ERR "NFS: server %s error: fileid changed\n"
1815
1820
"fsid %s: expected fileid 0x%Lx, got 0x%Lx\n" ,
1816
1821
NFS_SERVER (inode )-> nfs_client -> cl_hostname ,
0 commit comments