Commit 147b89c4 authored by Theodore Ts'o's avatar Theodore Ts'o Committed by Greg Kroah-Hartman

ext4: clear mmp sequence number when remounting read-only

[ Upstream commit 2dca60d9 ]

Previously, when an MMP-protected file system is remounted read-only,
the kmmpd thread would exit the next time it woke up (a few seconds
later), without resetting the MMP sequence number back to
EXT4_MMP_SEQ_CLEAN.

Fix this by explicitly killing the MMP thread when the file system is
remounted read-only.
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Cc: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent de044d4e
...@@ -186,11 +186,8 @@ static int kmmpd(void *data) ...@@ -186,11 +186,8 @@ static int kmmpd(void *data)
goto exit_thread; goto exit_thread;
} }
if (sb_rdonly(sb)) { if (sb_rdonly(sb))
ext4_warning(sb, "kmmpd being stopped since filesystem " break;
"has been remounted as readonly.");
goto exit_thread;
}
diff = jiffies - last_update_time; diff = jiffies - last_update_time;
if (diff < mmp_update_interval * HZ) if (diff < mmp_update_interval * HZ)
......
...@@ -5163,6 +5163,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) ...@@ -5163,6 +5163,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
if (sbi->s_journal) if (sbi->s_journal)
ext4_mark_recovery_complete(sb, es); ext4_mark_recovery_complete(sb, es);
if (sbi->s_mmp_tsk)
kthread_stop(sbi->s_mmp_tsk);
} else { } else {
/* Make sure we can mount this feature set readwrite */ /* Make sure we can mount this feature set readwrite */
if (ext4_has_feature_readonly(sb) || if (ext4_has_feature_readonly(sb) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment