dt-bindings: clock: Add bindings for Raspberry Pi RP1
[platform/kernel/linux-rpi.git] / fs / ext4 / super.c
index dbebd8b..d062383 100644 (file)
@@ -768,7 +768,8 @@ static void update_super_work(struct work_struct *work)
         */
        if (!sb_rdonly(sbi->s_sb) && journal) {
                struct buffer_head *sbh = sbi->s_sbh;
-               bool call_notify_err;
+               bool call_notify_err = false;
+
                handle = jbd2_journal_start(journal, 1);
                if (IS_ERR(handle))
                        goto write_directly;
@@ -6442,6 +6443,7 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
        struct ext4_mount_options old_opts;
        ext4_group_t g;
        int err = 0;
+       int alloc_ctx;
 #ifdef CONFIG_QUOTA
        int enable_quota = 0;
        int i, j;
@@ -6482,7 +6484,16 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
 
        }
 
+       /*
+        * Changing the DIOREAD_NOLOCK or DELALLOC mount options may cause
+        * two calls to ext4_should_dioread_nolock() to return inconsistent
+        * values, triggering WARN_ON in ext4_add_complete_io(). we grab
+        * here s_writepages_rwsem to avoid race between writepages ops and
+        * remount.
+        */
+       alloc_ctx = ext4_writepages_down_write(sb);
        ext4_apply_options(fc, sb);
+       ext4_writepages_up_write(sb, alloc_ctx);
 
        if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^
            test_opt(sb, JOURNAL_CHECKSUM)) {
@@ -6700,6 +6711,8 @@ restore_opts:
        if (sb_rdonly(sb) && !(old_sb_flags & SB_RDONLY) &&
            sb_any_quota_suspended(sb))
                dquot_resume(sb, -1);
+
+       alloc_ctx = ext4_writepages_down_write(sb);
        sb->s_flags = old_sb_flags;
        sbi->s_mount_opt = old_opts.s_mount_opt;
        sbi->s_mount_opt2 = old_opts.s_mount_opt2;
@@ -6708,6 +6721,8 @@ restore_opts:
        sbi->s_commit_interval = old_opts.s_commit_interval;
        sbi->s_min_batch_time = old_opts.s_min_batch_time;
        sbi->s_max_batch_time = old_opts.s_max_batch_time;
+       ext4_writepages_up_write(sb, alloc_ctx);
+
        if (!test_opt(sb, BLOCK_VALIDITY) && sbi->s_system_blks)
                ext4_release_system_zone(sb);
 #ifdef CONFIG_QUOTA