[PATCH] [FS] jffs2: check if partition is marked RO on mount

Sebastian Siewior bigeasy at tglx.de
Thu Mar 6 04:02:09 EST 2008


and if it is, don't tell userspace that write is possible. Mount it RO
instead.

Signed-off-by: Sebastian Siewior <bigeasy at linutronix.de>
---
 fs/jffs2/super.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 4677355..e4c9493 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -108,6 +108,9 @@ static int jffs2_fill_super(struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_JFFS2_FS_POSIX_ACL
 	sb->s_flags |= MS_POSIXACL;
 #endif
+	if (!(c->mtd->flags & MTD_WRITEABLE))
+		sb->s_flags |= MS_RDONLY;
+
 	return jffs2_do_fill_super(sb, data, silent);
 }
 
-- 
1.5.3.5




More information about the linux-mtd mailing list