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>
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user