NFS: Clean up process of marking inode stale.
Instead of the various open coded calls to set the NFS_INO_STALE bit and call nfs_zap_caches(), consolidate them into a single function nfs_set_inode_stale(). Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
@@ -62,7 +62,6 @@
|
||||
/* Default is to see 64-bit inode numbers */
|
||||
static bool enable_ino64 = NFS_64_BIT_INODE_NUMBERS_ENABLED;
|
||||
|
||||
static void nfs_invalidate_inode(struct inode *);
|
||||
static int nfs_update_inode(struct inode *, struct nfs_fattr *);
|
||||
|
||||
static struct kmem_cache * nfs_inode_cachep;
|
||||
@@ -284,10 +283,18 @@ EXPORT_SYMBOL_GPL(nfs_invalidate_atime);
|
||||
* Invalidate, but do not unhash, the inode.
|
||||
* NB: must be called with inode->i_lock held!
|
||||
*/
|
||||
static void nfs_invalidate_inode(struct inode *inode)
|
||||
static void nfs_set_inode_stale_locked(struct inode *inode)
|
||||
{
|
||||
set_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
|
||||
nfs_zap_caches_locked(inode);
|
||||
trace_nfs_set_inode_stale(inode);
|
||||
}
|
||||
|
||||
void nfs_set_inode_stale(struct inode *inode)
|
||||
{
|
||||
spin_lock(&inode->i_lock);
|
||||
nfs_set_inode_stale_locked(inode);
|
||||
spin_unlock(&inode->i_lock);
|
||||
}
|
||||
|
||||
struct nfs_find_desc {
|
||||
@@ -1163,9 +1170,10 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
|
||||
status = 0;
|
||||
break;
|
||||
case -ESTALE:
|
||||
nfs_zap_caches(inode);
|
||||
if (!S_ISDIR(inode->i_mode))
|
||||
set_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
|
||||
nfs_set_inode_stale(inode);
|
||||
else
|
||||
nfs_zap_caches(inode);
|
||||
}
|
||||
goto err_out;
|
||||
}
|
||||
@@ -2064,7 +2072,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
|
||||
* lookup validation will know that the inode is bad.
|
||||
* (But we fall through to invalidate the caches.)
|
||||
*/
|
||||
nfs_invalidate_inode(inode);
|
||||
nfs_set_inode_stale_locked(inode);
|
||||
return -ESTALE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user