summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/scrub/common.c19
-rw-r--r--fs/xfs/scrub/common.h8
2 files changed, 27 insertions, 0 deletions
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c
index 30b2737451bc..d83ce0258897 100644
--- a/fs/xfs/scrub/common.c
+++ b/fs/xfs/scrub/common.c
@@ -29,6 +29,7 @@
#include "xfs_attr.h"
#include "xfs_reflink.h"
#include "xfs_ag.h"
+#include "xfs_quota.h"
#include "scrub/scrub.h"
#include "scrub/common.h"
#include "scrub/trace.h"
@@ -789,6 +790,22 @@ again:
return error;
}
+#ifdef CONFIG_XFS_QUOTA
+/*
+ * Try to attach dquots to this inode if we think we might want to repair it.
+ * Quota itself could need repairs, so we don't require success here.
+ */
+void
+xchk_try_dqattach(
+ struct xfs_scrub *sc)
+{
+ ASSERT(sc->ip != NULL);
+
+ if (xchk_could_repair(sc))
+ xfs_qm_dqattach(sc->ip);
+}
+#endif
+
/* Install an inode that we opened by handle for scrubbing. */
int
xchk_install_handle_inode(
@@ -801,6 +818,7 @@ xchk_install_handle_inode(
}
sc->ip = ip;
+ xchk_try_dqattach(sc);
return 0;
}
@@ -820,6 +838,7 @@ xchk_install_live_inode(
}
sc->ip = ip;
+ xchk_try_dqattach(sc);
return 0;
}
diff --git a/fs/xfs/scrub/common.h b/fs/xfs/scrub/common.h
index 49dcaa43d0ed..9cea43a4fd6c 100644
--- a/fs/xfs/scrub/common.h
+++ b/fs/xfs/scrub/common.h
@@ -102,9 +102,17 @@ xchk_setup_rtsummary(struct xfs_scrub *sc)
return -ENOENT;
}
#endif
+
#ifdef CONFIG_XFS_QUOTA
+void xchk_try_dqattach(struct xfs_scrub *sc);
int xchk_setup_quota(struct xfs_scrub *sc);
#else
+static inline void
+xchk_try_dqattach(struct xfs_scrub *sc)
+{
+ ASSERT(sc->ip != NULL);
+}
+
static inline int
xchk_setup_quota(struct xfs_scrub *sc)
{