From: "Luis R. Rodriguez" <mcgrof@suse.com>
Subject: [PATCH] xfs: extend unsupported annotations: reflink or reverse
mapping btree
References: FATE#324503
Patch-mainline: Never, SUSE-specific
Reflink support is not yet ready for prime time upstream.
Neither is reverse mapping btree support.
So only allow read-only mount on these, unless a user loads the
module with allow_unsupported=1.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
fs/xfs/xfs_super.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -61,6 +61,10 @@
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/parser.h>
+#include <linux/unsupported-feature.h>
+
+DECLARE_SUSE_UNSUPPORTED_FEATURE(xfs);
+DEFINE_SUSE_UNSUPPORTED_FEATURE(xfs);
static const struct super_operations xfs_super_operations;
struct bio_set *xfs_ioend_bioset;
@@ -1547,6 +1551,20 @@ xfs_destroy_percpu_counters(
percpu_counter_destroy(&mp->m_fdblocks);
}
+int
+xfs_check_unsupported(struct xfs_mount *mp, const char *description)
+{
+ if (mp->m_flags & XFS_MOUNT_RDONLY)
+ return 0;
+
+ if (xfs_allow_unsupported())
+ return 0;
+
+ xfs_alert(mp, "Couldn't mount because of unsupported optional feature %s. Load module with allow_unsupported=1.",
+ description);
+ return -EOPNOTSUPP;
+}
+
STATIC int
xfs_fs_fill_super(
struct super_block *sb,
@@ -1642,8 +1660,6 @@ xfs_fs_fill_super(
if (mp->m_flags & XFS_MOUNT_DAX) {
bool rtdev_is_dax = false, datadev_is_dax;
- xfs_warn(mp,
- "DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
datadev_is_dax = bdev_dax_supported(mp->m_ddev_targp->bt_bdev,
sb->s_blocksize);
@@ -1667,13 +1683,20 @@ xfs_fs_fill_super(
error = -EINVAL;
goto out_filestream_unmount;
}
+ error = xfs_check_unsupported(mp, "EXPERIMENTAL reverse mapping btree");
+ if (error)
+ goto out_filestream_unmount;
xfs_alert(mp,
"EXPERIMENTAL reverse mapping btree feature enabled. Use at your own risk!");
}
- if (xfs_sb_version_hasreflink(&mp->m_sb))
+ if (xfs_sb_version_hasreflink(&mp->m_sb)) {
+ error = xfs_check_unsupported(mp, "EXPERIMENTAL reflink support");
+ if (error)
+ goto out_filestream_unmount;
xfs_alert(mp,
"EXPERIMENTAL reflink feature enabled. Use at your own risk!");
+ }
if (xfs_sb_version_hasinobtcounts(&mp->m_sb))
xfs_warn(mp,