[PATCH 5/5] xfs: scrub should flag (and repair) unfixed agfls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

If somehow we let a fs with an unfixed agfl slip by, we should flag it
and try to repair it.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 fs/xfs/scrub/agheader.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)


diff --git a/fs/xfs/scrub/agheader.c b/fs/xfs/scrub/agheader.c
index fbd1744..d548656 100644
--- a/fs/xfs/scrub/agheader.c
+++ b/fs/xfs/scrub/agheader.c
@@ -160,8 +160,13 @@ xfs_scrub_superblock(
 	__be16				vernum_mask;
 
 	agno = sc->sm->sm_agno;
-	if (agno == 0)
+	if (agno == 0) {
+		/* If we somehow don't have a fixed agfl, preen... */
+		if (xfs_sb_version_hascrc(&mp->m_sb) &&
+		    !xfs_sb_version_hasfixedagfl(&mp->m_sb))
+			xfs_scrub_block_set_preen(sc, mp->m_sb_bp);
 		return 0;
+	}
 
 	error = xfs_trans_read_buf(mp, sc->tp, mp->m_ddev_targp,
 		  XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
@@ -444,8 +449,13 @@ xfs_repair_superblock(
 
 	/* Don't try to repair AG 0's sb; let xfs_repair deal with it. */
 	agno = sc->sm->sm_agno;
-	if (agno == 0)
+	if (agno == 0) {
+		/* Try to fix the AGFLs if we don't have the feature set */
+		if ((sc->sm->sm_flags & XFS_SCRUB_OFLAG_PREEN) &&
+		    !(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
+			return xfs_agf_fixup_freelist_counts(mp);
 		return -EOPNOTSUPP;
+	}
 
 	error = xfs_trans_read_buf(mp, sc->tp, mp->m_ddev_targp,
 		  XFS_AG_DADDR(mp, agno, XFS_SB_BLOCK(mp)),

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux