Apply Arnd's patches to extend superblock times beyond 2038
[ext4-patch-queue.git] / clean-mmp-status-on-remount-ro
blob202ec1dd432caf9130496dc3254147d6b1626ba9
1 ext4: clear mmp sequence number when remounting read-only
3 Previously, when an MMP-protected file system is remounted read-only,
4 the kmmpd thread would exit the next time it woke up (a few seconds
5 later), without resetting the MMP sequence number back to
6 EXT4_MMP_SEQ_CLEAN.
8 Fix this by explicitly killing the MMP thread when the file system is
9 remounted read-only.
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 Cc: Andreas Dilger <adilger@dilger.ca>
13 ---
14  fs/ext4/mmp.c   | 7 ++-----
15  fs/ext4/super.c | 2 ++
16  2 files changed, 4 insertions(+), 5 deletions(-)
18 diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
19 index 27b9a76a0dfa..638ad4743477 100644
20 --- a/fs/ext4/mmp.c
21 +++ b/fs/ext4/mmp.c
22 @@ -186,11 +186,8 @@ static int kmmpd(void *data)
23                         goto exit_thread;
24                 }
26 -               if (sb_rdonly(sb)) {
27 -                       ext4_warning(sb, "kmmpd being stopped since filesystem "
28 -                                    "has been remounted as readonly.");
29 -                       goto exit_thread;
30 -               }
31 +               if (sb_rdonly(sb))
32 +                       break;
34                 diff = jiffies - last_update_time;
35                 if (diff < mmp_update_interval * HZ)
36 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
37 index 90d0e113a174..38b5d2a22a63 100644
38 --- a/fs/ext4/super.c
39 +++ b/fs/ext4/super.c
40 @@ -5219,6 +5219,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
42                         if (sbi->s_journal)
43                                 ext4_mark_recovery_complete(sb, es);
44 +                       if (sbi->s_mmp_tsk)
45 +                               kthread_stop(sbi->s_mmp_tsk);
46                 } else {
47                         /* Make sure we can mount this feature set readwrite */
48                         if (ext4_has_feature_readonly(sb) ||