serial: core: Preserve termios c_cflag for console resume
[firefly-linux-kernel-4.4.55.git] / drivers / md / md.c
index 00a99fe797d402c24c10d2548d32144331008d90..aaf77b07bb727960557e075f17f9f4fd11485a26 100644 (file)
@@ -7338,8 +7338,10 @@ void md_do_sync(struct md_thread *thread)
        /* just incase thread restarts... */
        if (test_bit(MD_RECOVERY_DONE, &mddev->recovery))
                return;
-       if (mddev->ro) /* never try to sync a read-only array */
+       if (mddev->ro) {/* never try to sync a read-only array */
+               set_bit(MD_RECOVERY_INTR, &mddev->recovery);
                return;
+       }
 
        if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
                if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery))
@@ -7445,6 +7447,19 @@ void md_do_sync(struct md_thread *thread)
                            rdev->recovery_offset < j)
                                j = rdev->recovery_offset;
                rcu_read_unlock();
+
+               /* If there is a bitmap, we need to make sure all
+                * writes that started before we added a spare
+                * complete before we start doing a recovery.
+                * Otherwise the write might complete and (via
+                * bitmap_endwrite) set a bit in the bitmap after the
+                * recovery has checked that bit and skipped that
+                * region.
+                */
+               if (mddev->bitmap) {
+                       mddev->pers->quiesce(mddev, 1);
+                       mddev->pers->quiesce(mddev, 0);
+               }
        }
 
        printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev));
@@ -7788,6 +7803,7 @@ void md_check_recovery(struct mddev *mddev)
                        /* There is no thread, but we need to call
                         * ->spare_active and clear saved_raid_disk
                         */
+                       set_bit(MD_RECOVERY_INTR, &mddev->recovery);
                        md_reap_sync_thread(mddev);
                        clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
                        goto unlock;