]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: report the health of quota counts
authorDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:30:51 +0000 (12:30 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:30:51 +0000 (12:30 -0800)
Report the health of quota counts.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_fs.h
fs/xfs/libxfs/xfs_health.h
fs/xfs/xfs_health.c
fs/xfs/xfs_qm.c
fs/xfs/xfs_trans_dquot.c

index 6360073865dbc3136e3655e1b493a53ca4310dd3..711e0fc7efab64705910e68e0bc1ea1ea53a7953 100644 (file)
@@ -195,6 +195,7 @@ struct xfs_fsop_geom {
 #define XFS_FSOP_GEOM_SICK_PQUOTA      (1 << 3)  /* project quota */
 #define XFS_FSOP_GEOM_SICK_RT_BITMAP   (1 << 4)  /* realtime bitmap */
 #define XFS_FSOP_GEOM_SICK_RT_SUMMARY  (1 << 5)  /* realtime summary */
+#define XFS_FSOP_GEOM_SICK_QUOTACHECK  (1 << 6)  /* quota counts */
 
 /* Output for XFS_FS_COUNTS */
 typedef struct xfs_fsop_counts {
index 6296993ff8f3df52a6e534f81ace861dd495d323..5626e53b3f0feedb55cc860634cce856758d52e7 100644 (file)
@@ -41,6 +41,7 @@ struct xfs_fsop_geom;
 #define XFS_SICK_FS_UQUOTA     (1 << 1)  /* user quota */
 #define XFS_SICK_FS_GQUOTA     (1 << 2)  /* group quota */
 #define XFS_SICK_FS_PQUOTA     (1 << 3)  /* project quota */
+#define XFS_SICK_FS_QUOTACHECK (1 << 4)  /* quota counts */
 
 /* Observable health issues for realtime volume metadata. */
 #define XFS_SICK_RT_BITMAP     (1 << 0)  /* realtime bitmap */
@@ -77,7 +78,8 @@ struct xfs_fsop_geom;
 #define XFS_SICK_FS_PRIMARY    (XFS_SICK_FS_COUNTERS | \
                                 XFS_SICK_FS_UQUOTA | \
                                 XFS_SICK_FS_GQUOTA | \
-                                XFS_SICK_FS_PQUOTA)
+                                XFS_SICK_FS_PQUOTA | \
+                                XFS_SICK_FS_QUOTACHECK)
 
 #define XFS_SICK_RT_PRIMARY    (XFS_SICK_RT_BITMAP | \
                                 XFS_SICK_RT_SUMMARY)
index 9a57afee933834125f2820712fce11783a6eda45..ef07af9f753d334d01aa92efc69f8ad4e8f64e89 100644 (file)
@@ -280,6 +280,7 @@ static const struct ioctl_sick_map fs_map[] = {
        { XFS_SICK_FS_UQUOTA,   XFS_FSOP_GEOM_SICK_UQUOTA },
        { XFS_SICK_FS_GQUOTA,   XFS_FSOP_GEOM_SICK_GQUOTA },
        { XFS_SICK_FS_PQUOTA,   XFS_FSOP_GEOM_SICK_PQUOTA },
+       { XFS_SICK_FS_QUOTACHECK, XFS_FSOP_GEOM_SICK_QUOTACHECK },
        { 0, 0 },
 };
 
index b5b555698ae1e6544224d4057c454006adf04c35..dca2f60b2e305c109eb1e969f25f517d7e1ebd2d 100644 (file)
@@ -26,6 +26,7 @@
 #include "xfs_ag.h"
 #include "xfs_ialloc.h"
 #include "xfs_log_priv.h"
+#include "xfs_health.h"
 
 /*
  * The global quota manager. There is only one of these for the entire
@@ -1408,8 +1409,12 @@ error_return:
                        xfs_warn(mp,
                                "Quotacheck: Failed to reset quota flags.");
                }
-       } else
+               xfs_fs_mark_sick(mp, XFS_SICK_FS_QUOTACHECK);
+       } else {
                xfs_notice(mp, "Quotacheck: Done.");
+               xfs_fs_mark_healthy(mp, XFS_SICK_FS_QUOTACHECK);
+       }
+
        return error;
 
 error_purge:
index 9c159d016ecf544fe0be1b28ba6cb1d4e5d6dbdc..30bde11aa1c25e75913386279302d4bffb5e1d4e 100644 (file)
@@ -17,6 +17,7 @@
 #include "xfs_qm.h"
 #include "xfs_trace.h"
 #include "xfs_error.h"
+#include "xfs_health.h"
 
 STATIC void    xfs_trans_alloc_dqinfo(xfs_trans_t *);
 
@@ -706,6 +707,7 @@ error_return:
 error_corrupt:
        xfs_dqunlock(dqp);
        xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
+       xfs_fs_mark_sick(mp, XFS_SICK_FS_QUOTACHECK);
        return -EFSCORRUPTED;
 }