提交 8a8c74bf 编写于 作者: C Chuck Lever 提交者: Trond Myklebust

NFS: Ensure nfs_wcc_update_inode always converts file size to loff_t

The nfs_wcc_update_inode() function omits logic to convert the type of
the NFS on-the-wire value of a file's size (__u64) to the type of file
size value stored in struct inode (loff_t, which is signed).

Everywhere else in the NFS client I checked already correctly converts the
file size type.

This effects only very large files.
Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 9b45b74c
......@@ -814,8 +814,9 @@ static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)
if (S_ISDIR(inode->i_mode))
nfsi->cache_validity |= NFS_INO_INVALID_DATA;
}
if (inode->i_size == fattr->pre_size && nfsi->npages == 0)
inode->i_size = fattr->size;
if (inode->i_size == nfs_size_to_loff_t(fattr->pre_size) &&
nfsi->npages == 0)
inode->i_size = nfs_size_to_loff_t(fattr->size);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册