mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-12 08:09:56 +00:00
NFS: More page cache revalidation fixups
Whenever the directory changes, we want to make sure that we always invalidate its page cache. Fix up update_changeattr() and nfs_mark_for_revalidate() so that they do so. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
f1bb0b92ba
commit
38478b24e3
@ -185,15 +185,15 @@ static void renew_lease(const struct nfs_server *server, unsigned long timestamp
|
|||||||
spin_unlock(&clp->cl_lock);
|
spin_unlock(&clp->cl_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_changeattr(struct inode *inode, struct nfs4_change_info *cinfo)
|
static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo)
|
||||||
{
|
{
|
||||||
struct nfs_inode *nfsi = NFS_I(inode);
|
struct nfs_inode *nfsi = NFS_I(dir);
|
||||||
|
|
||||||
spin_lock(&inode->i_lock);
|
spin_lock(&dir->i_lock);
|
||||||
nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
|
nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA;
|
||||||
if (cinfo->before == nfsi->change_attr && cinfo->atomic)
|
if (cinfo->before == nfsi->change_attr && cinfo->atomic)
|
||||||
nfsi->change_attr = cinfo->after;
|
nfsi->change_attr = cinfo->after;
|
||||||
spin_unlock(&inode->i_lock);
|
spin_unlock(&dir->i_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nfs4_opendata {
|
struct nfs4_opendata {
|
||||||
|
@ -234,8 +234,12 @@ static inline int nfs_caches_unstable(struct inode *inode)
|
|||||||
|
|
||||||
static inline void nfs_mark_for_revalidate(struct inode *inode)
|
static inline void nfs_mark_for_revalidate(struct inode *inode)
|
||||||
{
|
{
|
||||||
|
struct nfs_inode *nfsi = NFS_I(inode);
|
||||||
|
|
||||||
spin_lock(&inode->i_lock);
|
spin_lock(&inode->i_lock);
|
||||||
NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS;
|
nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS;
|
||||||
|
if (S_ISDIR(inode->i_mode))
|
||||||
|
nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA;
|
||||||
spin_unlock(&inode->i_lock);
|
spin_unlock(&inode->i_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user