Skip to content

Commit 2dca60d

Browse files
committed
ext4: clear mmp sequence number when remounting read-only
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: Theodore Ts'o <tytso@mit.edu> Cc: Andreas Dilger <adilger@dilger.ca>
1 parent 44de022 commit 2dca60d

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

fs/ext4/mmp.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,8 @@ static int kmmpd(void *data)
186186
goto exit_thread;
187187
}
188188

189-
if (sb_rdonly(sb)) {
190-
ext4_warning(sb, "kmmpd being stopped since filesystem "
191-
"has been remounted as readonly.");
192-
goto exit_thread;
193-
}
189+
if (sb_rdonly(sb))
190+
break;
194191

195192
diff = jiffies - last_update_time;
196193
if (diff < mmp_update_interval * HZ)

fs/ext4/super.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5212,6 +5212,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
52125212

52135213
if (sbi->s_journal)
52145214
ext4_mark_recovery_complete(sb, es);
5215+
if (sbi->s_mmp_tsk)
5216+
kthread_stop(sbi->s_mmp_tsk);
52155217
} else {
52165218
/* Make sure we can mount this feature set readwrite */
52175219
if (ext4_has_feature_readonly(sb) ||

0 commit comments

Comments
 (0)