From: Jeff Mahoney <jeffm@suse.com>
Subject: reiserfs: mark read-write mode unsupported
References: FATE#323394
Patch-mainline: Never, SUSE-specific
SLE15 will not have reiserfs support but it is required to be able to
identify and/or migrate existing file systems. This patch disabled
read-write mode on supported systems.
We return -EACCES and mount(8) will retry in read-only mode before
issuing a message about the device being read-only.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/reiserfs/super.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -30,6 +30,26 @@
#include <linux/namei.h>
#include <linux/crc32.h>
#include <linux/seq_file.h>
+#include <linux/moduleparam.h>
+#include <linux/unsupported-feature.h>
+
+DECLARE_SUSE_UNSUPPORTED_FEATURE(reiserfs)
+DEFINE_SUSE_UNSUPPORTED_FEATURE(reiserfs)
+
+static bool check_rw_mount(struct super_block *sb, unsigned long flags)
+{
+ if (flags & MS_RDONLY)
+ return true;
+
+ if (reiserfs_allow_unsupported()) {
+ reiserfs_mark_unsupported();
+ return true;
+ }
+
+ pr_warn("reiserfs: read-write mode is unsupported.\n");
+ pr_warn("reiserfs: load module with allow_unsupported=1 to enable read-write mode.\n");
+ return false;
+}
struct file_system_type reiserfs_fs_type;
@@ -1450,6 +1470,9 @@ static int reiserfs_remount(struct super
int i;
#endif
+ if (!check_rw_mount(s, *mount_flags))
+ return -EACCES;
+
new_opts = kstrdup(arg, GFP_KERNEL);
if (arg && !new_opts)
return -ENOMEM;
@@ -1916,6 +1939,9 @@ static int reiserfs_fill_super(struct su
char *qf_names[REISERFS_MAXQUOTAS] = {};
unsigned int qfmt = 0;
+ if (!check_rw_mount(s, s->s_flags))
+ return -EACCES;
+
save_mount_options(s, data);
sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL);