Skip to content

Commit eb3d8f4

Browse files
author
Trond Myklebust
committed
NFS: Fix inode fileid checks in attribute revalidation code
We want to throw out the attrbute if it refers to the mounted on fileid, and not the real fileid. However we do not want to block cache consistency updates from NFSv4 writes. Reported-by: Murphy Zhou <[email protected]> Fixes: 7e10cc2 ("NFS: Don't refresh attributes with mounted-on-file...") Signed-off-by: Trond Myklebust <[email protected]>
1 parent 089cf7f commit eb3d8f4

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

fs/nfs/inode.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,11 +1403,12 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat
14031403
if (NFS_PROTO(inode)->have_delegation(inode, FMODE_READ))
14041404
return 0;
14051405

1406-
/* No fileid? Just exit */
1407-
if (!(fattr->valid & NFS_ATTR_FATTR_FILEID))
1408-
return 0;
1406+
if (!(fattr->valid & NFS_ATTR_FATTR_FILEID)) {
1407+
/* Only a mounted-on-fileid? Just exit */
1408+
if (fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID)
1409+
return 0;
14091410
/* Has the inode gone and changed behind our back? */
1410-
if (nfsi->fileid != fattr->fileid) {
1411+
} else if (nfsi->fileid != fattr->fileid) {
14111412
/* Is this perhaps the mounted-on fileid? */
14121413
if ((fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) &&
14131414
nfsi->fileid == fattr->mounted_on_fileid)
@@ -1807,11 +1808,12 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
18071808
nfs_display_fhandle_hash(NFS_FH(inode)),
18081809
atomic_read(&inode->i_count), fattr->valid);
18091810

1810-
/* No fileid? Just exit */
1811-
if (!(fattr->valid & NFS_ATTR_FATTR_FILEID))
1812-
return 0;
1811+
if (!(fattr->valid & NFS_ATTR_FATTR_FILEID)) {
1812+
/* Only a mounted-on-fileid? Just exit */
1813+
if (fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID)
1814+
return 0;
18131815
/* Has the inode gone and changed behind our back? */
1814-
if (nfsi->fileid != fattr->fileid) {
1816+
} else if (nfsi->fileid != fattr->fileid) {
18151817
/* Is this perhaps the mounted-on fileid? */
18161818
if ((fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) &&
18171819
nfsi->fileid == fattr->mounted_on_fileid)

0 commit comments

Comments
 (0)