summaryrefslogtreecommitdiffstats
path: root/fs/ext2
diff options
context:
space:
mode:
authorChengguang Xu2018-11-07 14:47:04 +0100
committerJan Kara2018-11-08 15:14:48 +0100
commitc0ed7b51ca9983086e03668f0ca20dc67ac663f4 (patch)
tree4bc3adfa25c3d34dccd878cce659cb8c0a5b611c /fs/ext2
parentMerge tag 'compiler-attributes-for-linus-v4.20-rc2' of https://github.com/oje... (diff)
downloadkernel-qcow2-linux-c0ed7b51ca9983086e03668f0ca20dc67ac663f4.tar.gz
kernel-qcow2-linux-c0ed7b51ca9983086e03668f0ca20dc67ac663f4.tar.xz
kernel-qcow2-linux-c0ed7b51ca9983086e03668f0ca20dc67ac663f4.zip
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 <cgxu519@gmx.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/super.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index cb91baa4275d..5e2861b947a6 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;