From: Chengguang Xu Date: Wed, 7 Nov 2018 13:47:04 +0000 (+0800) Subject: ext2: avoid unnecessary operation in ext2_error() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c0ed7b51ca9983086e03668f0ca20dc67ac663f4;p=linux.git ext2: avoid unnecessary operation in ext2_error() If filesystem has already mounted as read-only, then we don't have to do it again. Signed-off-by: Chengguang Xu Signed-off-by: Jan Kara --- diff --git a/fs/ext2/super.c b/fs/ext2/super.c index cb91baa4275d8..5e2861b947a63 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -73,7 +73,7 @@ void ext2_error(struct super_block *sb, const char *function, if (test_opt(sb, ERRORS_PANIC)) panic("EXT2-fs: panic from previous error\n"); - if (test_opt(sb, ERRORS_RO)) { + if (!sb_rdonly(sb) && test_opt(sb, ERRORS_RO)) { ext2_msg(sb, KERN_CRIT, "error: remounting filesystem read-only"); sb->s_flags |= SB_RDONLY;