summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/scrub/common.c')
-rw-r--r--fs/xfs/scrub/common.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c
index 0055299170e2..0ea9b6b299ae 100644
--- a/fs/xfs/scrub/common.c
+++ b/fs/xfs/scrub/common.c
@@ -863,8 +863,7 @@ xchk_get_inode(
/* Look up the inode, see if the generation number matches. */
if (xfs_internal_inum(mp, sc->sm->sm_ino))
return -ENOENT;
- error = xfs_iget(mp, NULL, sc->sm->sm_ino,
- XFS_IGET_UNTRUSTED | XFS_IGET_DONTCACHE, 0, &ip);
+ error = xfs_iget(mp, NULL, sc->sm->sm_ino, XFS_IGET_UNTRUSTED, 0, &ip);
switch (error) {
case -ENOENT:
/* Inode doesn't exist, just bail out. */
@@ -886,7 +885,7 @@ xchk_get_inode(
* that it no longer exists.
*/
error = xfs_imap(sc->mp, sc->tp, sc->sm->sm_ino, &imap,
- XFS_IGET_UNTRUSTED | XFS_IGET_DONTCACHE);
+ XFS_IGET_UNTRUSTED);
if (error)
return -ENOENT;
error = -EFSCORRUPTED;
@@ -911,7 +910,7 @@ xchk_get_inode(
*/
if (VFS_I(ip)->i_generation != sc->sm->sm_gen ||
(xfs_is_metadata_inode(ip) && !S_ISDIR(VFS_I(ip)->i_mode))) {
- xfs_irele(ip);
+ xchk_irele(sc, ip);
return -ENOENT;
}
@@ -919,6 +918,24 @@ xchk_get_inode(
return 0;
}
+void
+__xchk_irele(
+ struct xfs_inode *ip,
+ bool set_dontcache)
+{
+ if (set_dontcache && atomic_read(&VFS_I(ip)->i_count) == 1)
+ d_mark_dontcache(VFS_I(ip));
+ xfs_irele(ip);
+}
+
+void
+xchk_irele(
+ struct xfs_scrub *sc,
+ struct xfs_inode *ip)
+{
+ __xchk_irele(ip, !(sc->sm->sm_flags & XFS_SCRUB_IFLAG_RETAIN_INODES));
+}
+
/* Set us up to scrub a file's contents. */
int
xchk_setup_inode_contents(