summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-12-04 13:41:36 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2020-12-06 15:17:19 -0800
commit5a6b9401f4b6314be6646b47eff8b4ac4015a12a (patch)
tree19e6361acc49b57615a5902a46b668af993042b9
parentc68bd2aebd9020a67a3ba5ae648ecbcea160e4ac (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;