summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-11-29 16:33:39 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2020-12-06 14:59:17 -0800
commit69b2cdb060424ea12f27100515241d4d5938ea67 (patch)
tree8a2bb6b6ce908626362b7cf686c05e98cc251e77
parent3f42eadb89ca1cba9679e56ff9cc7868186b3333 (diff)
xfs: validate feature support when recovering rmap/refcount/bmap intents
The bmap, rmap, and refcount log intent items were added to support the rmap and reflink features. Because these features come with changes to the ondisk format, the log items aren't tied to a log incompat flag. However, the log recovery routines don't actually check for those feature flags. The kernel has no business replayng an intent item for a feature that isn't enabled, so check that as part of recovered log item validation. (Note that kernels pre-dating rmap and reflink will fail the mount on the unknown log item type code.) Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--fs/xfs/xfs_bmap_item.c4
-rw-r--r--fs/xfs/xfs_refcount_item.c3
-rw-r--r--fs/xfs/xfs_rmap_item.c3
3 files changed, 10 insertions, 0 deletions
diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
index a21a9f71c0c0..8d3ed07800f6 100644
--- a/fs/xfs/xfs_bmap_item.c
+++ b/fs/xfs/xfs_bmap_item.c
@@ -425,6 +425,10 @@ xfs_bui_validate(
{
struct xfs_map_extent *bmap;
+ if (!xfs_sb_version_hasrmapbt(&mp->m_sb) &&
+ !xfs_sb_version_hasreflink(&mp->m_sb))
+ return false;
+
/* Only one mapping operation per BUI... */
if (buip->bui_format.bui_nextents != XFS_BUI_MAX_FAST_EXTENTS)
return false;
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
index c24f2da0f795..937d482c9be4 100644
--- a/fs/xfs/xfs_refcount_item.c
+++ b/fs/xfs/xfs_refcount_item.c
@@ -423,6 +423,9 @@ xfs_cui_validate_phys(
struct xfs_mount *mp,
struct xfs_phys_extent *refc)
{
+ if (!xfs_sb_version_hasreflink(&mp->m_sb))
+ return false;
+
if (refc->pe_flags & ~XFS_REFCOUNT_EXTENT_FLAGS)
return false;
diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c
index 6f3250a22093..9b84017184d9 100644
--- a/fs/xfs/xfs_rmap_item.c
+++ b/fs/xfs/xfs_rmap_item.c
@@ -466,6 +466,9 @@ xfs_rui_validate_map(
struct xfs_mount *mp,
struct xfs_map_extent *rmap)
{
+ if (!xfs_sb_version_hasrmapbt(&mp->m_sb))
+ return false;
+
if (rmap->me_flags & ~XFS_RMAP_EXTENT_FLAGS)
return false;