NFSv4: Allow attribute caching with 'noac' mounts if client holds a delegation
If the server has given us a delegation on a file, we _know_ that we can cache the attribute information even when the user has specified 'noac'. Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Родитель
a8ce4a8f37
Коммит
d7cf8dd012
|
@ -161,14 +161,17 @@ static int nfs_revalidate_file_size(struct inode *inode, struct file *filp)
|
||||||
struct nfs_server *server = NFS_SERVER(inode);
|
struct nfs_server *server = NFS_SERVER(inode);
|
||||||
struct nfs_inode *nfsi = NFS_I(inode);
|
struct nfs_inode *nfsi = NFS_I(inode);
|
||||||
|
|
||||||
if (server->flags & NFS_MOUNT_NOAC)
|
if (nfs_have_delegated_attributes(inode))
|
||||||
goto force_reval;
|
goto out_noreval;
|
||||||
|
|
||||||
if (filp->f_flags & O_DIRECT)
|
if (filp->f_flags & O_DIRECT)
|
||||||
goto force_reval;
|
goto force_reval;
|
||||||
if (nfsi->npages != 0)
|
if (nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)
|
||||||
return 0;
|
goto force_reval;
|
||||||
if (!(nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) && !nfs_attribute_timeout(inode))
|
if (nfs_attribute_timeout(inode))
|
||||||
return 0;
|
goto force_reval;
|
||||||
|
out_noreval:
|
||||||
|
return 0;
|
||||||
force_reval:
|
force_reval:
|
||||||
return __nfs_revalidate_inode(server, inode);
|
return __nfs_revalidate_inode(server, inode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -742,9 +742,14 @@ int nfs_attribute_timeout(struct inode *inode)
|
||||||
{
|
{
|
||||||
struct nfs_inode *nfsi = NFS_I(inode);
|
struct nfs_inode *nfsi = NFS_I(inode);
|
||||||
|
|
||||||
|
return !time_in_range_open(jiffies, nfsi->read_cache_jiffies, nfsi->read_cache_jiffies + nfsi->attrtimeo);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int nfs_attribute_cache_expired(struct inode *inode)
|
||||||
|
{
|
||||||
if (nfs_have_delegated_attributes(inode))
|
if (nfs_have_delegated_attributes(inode))
|
||||||
return 0;
|
return 0;
|
||||||
return !time_in_range_open(jiffies, nfsi->read_cache_jiffies, nfsi->read_cache_jiffies + nfsi->attrtimeo);
|
return nfs_attribute_timeout(inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -757,7 +762,7 @@ int nfs_attribute_timeout(struct inode *inode)
|
||||||
int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
|
int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
|
||||||
{
|
{
|
||||||
if (!(NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATTR)
|
if (!(NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATTR)
|
||||||
&& !nfs_attribute_timeout(inode))
|
&& !nfs_attribute_cache_expired(inode))
|
||||||
return NFS_STALE(inode) ? -ESTALE : 0;
|
return NFS_STALE(inode) ? -ESTALE : 0;
|
||||||
return __nfs_revalidate_inode(server, inode);
|
return __nfs_revalidate_inode(server, inode);
|
||||||
}
|
}
|
||||||
|
@ -794,7 +799,8 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)
|
if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)
|
||||||
|| nfs_attribute_timeout(inode) || NFS_STALE(inode)) {
|
|| nfs_attribute_cache_expired(inode)
|
||||||
|
|| NFS_STALE(inode)) {
|
||||||
ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
|
ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче