summaryrefslogtreecommitdiffstats
path: root/fs/xfs/scrub/scrub.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2017-10-17 21:37:42 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2017-10-26 15:38:25 -0700
commit80e4e12688029e42fc6ab4cf7f229b090c61e6a7 (patch)
treed4d38776ab3c70d35453effa488ab947533687eb /fs/xfs/scrub/scrub.c
parentedc09b528628afb50904106f36de182a00e7eb40 (diff)
downloadlinux-80e4e12688029e42fc6ab4cf7f229b090c61e6a7.tar.bz2
xfs: scrub inodes
Scrub the fields within an inode. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/scrub/scrub.c')
-rw-r--r--fs/xfs/scrub/scrub.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/fs/xfs/scrub/scrub.c b/fs/xfs/scrub/scrub.c
index f83f454cabe6..45cc04680b8c 100644
--- a/fs/xfs/scrub/scrub.c
+++ b/fs/xfs/scrub/scrub.c
@@ -30,6 +30,8 @@
#include "xfs_trans.h"
#include "xfs_sb.h"
#include "xfs_inode.h"
+#include "xfs_icache.h"
+#include "xfs_itable.h"
#include "xfs_alloc.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap.h"
@@ -141,6 +143,7 @@ xfs_scrub_probe(
STATIC int
xfs_scrub_teardown(
struct xfs_scrub_context *sc,
+ struct xfs_inode *ip_in,
int error)
{
xfs_scrub_ag_free(sc, &sc->sa);
@@ -148,6 +151,13 @@ xfs_scrub_teardown(
xfs_trans_cancel(sc->tp);
sc->tp = NULL;
}
+ if (sc->ip) {
+ xfs_iunlock(sc->ip, sc->ilock_flags);
+ if (sc->ip != ip_in &&
+ !xfs_internal_inum(sc->mp, sc->ip->i_ino))
+ iput(VFS_I(sc->ip));
+ sc->ip = NULL;
+ }
return error;
}
@@ -201,6 +211,10 @@ static const struct xfs_scrub_meta_ops meta_scrub_ops[] = {
.scrub = xfs_scrub_refcountbt,
.has = xfs_sb_version_hasreflink,
},
+ { /* inode record */
+ .setup = xfs_scrub_setup_inode,
+ .scrub = xfs_scrub_inode,
+ },
};
/* This isn't a stable feature, warn once per day. */
@@ -300,7 +314,7 @@ retry_op:
* Tear down everything we hold, then set up again with
* preparation for worst-case scenarios.
*/
- error = xfs_scrub_teardown(&sc, 0);
+ error = xfs_scrub_teardown(&sc, ip, 0);
if (error)
goto out;
try_harder = true;
@@ -313,7 +327,7 @@ retry_op:
xfs_alert_ratelimited(mp, "Corruption detected during scrub.");
out_teardown:
- error = xfs_scrub_teardown(&sc, error);
+ error = xfs_scrub_teardown(&sc, ip, error);
out:
trace_xfs_scrub_done(ip, sm, error);
if (error == -EFSCORRUPTED || error == -EFSBADCRC) {