lockdep_is_held(&mddev->reconfig_mutex));
 
        WARN_ON_ONCE(thread && current == thread->tsk);
-       if (mddev->suspended++)
+
+       /* can't concurrent with __mddev_suspend() and __mddev_resume() */
+       mutex_lock(&mddev->suspend_mutex);
+       if (mddev->suspended++) {
+               mutex_unlock(&mddev->suspend_mutex);
                return;
+       }
+
        wake_up(&mddev->sb_wait);
        set_bit(MD_ALLOW_SB_UPDATE, &mddev->flags);
        percpu_ref_kill(&mddev->active_io);
 
+       /*
+        * TODO: cleanup 'pers->prepare_suspend after all callers are replaced
+        * by __mddev_suspend().
+        */
        if (mddev->pers && mddev->pers->prepare_suspend)
                mddev->pers->prepare_suspend(mddev);
 
        del_timer_sync(&mddev->safemode_timer);
        /* restrict memory reclaim I/O during raid array is suspend */
        mddev->noio_flag = memalloc_noio_save();
+
+       mutex_unlock(&mddev->suspend_mutex);
 }
 EXPORT_SYMBOL_GPL(mddev_suspend);
 
 void mddev_resume(struct mddev *mddev)
 {
        lockdep_assert_held(&mddev->reconfig_mutex);
-       if (--mddev->suspended)
+
+       /* can't concurrent with __mddev_suspend() and __mddev_resume() */
+       mutex_lock(&mddev->suspend_mutex);
+       if (--mddev->suspended) {
+               mutex_unlock(&mddev->suspend_mutex);
                return;
+       }
 
        /* entred the memalloc scope from mddev_suspend() */
        memalloc_noio_restore(mddev->noio_flag);
        set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
        md_wakeup_thread(mddev->thread);
        md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */
+
+       mutex_unlock(&mddev->suspend_mutex);
 }
 EXPORT_SYMBOL_GPL(mddev_resume);
 
+int __mddev_suspend(struct mddev *mddev, bool interruptible)
+{
+       int err = 0;
+
+       /*
+        * hold reconfig_mutex to wait for normal io will deadlock, because
+        * other context can't update super_block, and normal io can rely on
+        * updating super_block.
+        */
+       lockdep_assert_not_held(&mddev->reconfig_mutex);
+
+       if (interruptible)
+               err = mutex_lock_interruptible(&mddev->suspend_mutex);
+       else
+               mutex_lock(&mddev->suspend_mutex);
+       if (err)
+               return err;
+
+       if (mddev->suspended) {
+               WRITE_ONCE(mddev->suspended, mddev->suspended + 1);
+               mutex_unlock(&mddev->suspend_mutex);
+               return 0;
+       }
+
+       percpu_ref_kill(&mddev->active_io);
+       if (interruptible)
+               err = wait_event_interruptible(mddev->sb_wait,
+                               percpu_ref_is_zero(&mddev->active_io));
+       else
+               wait_event(mddev->sb_wait,
+                               percpu_ref_is_zero(&mddev->active_io));
+       if (err) {
+               percpu_ref_resurrect(&mddev->active_io);
+               mutex_unlock(&mddev->suspend_mutex);
+               return err;
+       }
+
+       /*
+        * For raid456, io might be waiting for reshape to make progress,
+        * allow new reshape to start while waiting for io to be done to
+        * prevent deadlock.
+        */
+       WRITE_ONCE(mddev->suspended, mddev->suspended + 1);
+
+       del_timer_sync(&mddev->safemode_timer);
+       /* restrict memory reclaim I/O during raid array is suspend */
+       mddev->noio_flag = memalloc_noio_save();
+
+       mutex_unlock(&mddev->suspend_mutex);
+       return 0;
+}
+EXPORT_SYMBOL_GPL(__mddev_suspend);
+
+void __mddev_resume(struct mddev *mddev)
+{
+       lockdep_assert_not_held(&mddev->reconfig_mutex);
+
+       mutex_lock(&mddev->suspend_mutex);
+       WRITE_ONCE(mddev->suspended, mddev->suspended - 1);
+       if (mddev->suspended) {
+               mutex_unlock(&mddev->suspend_mutex);
+               return;
+       }
+
+       /* entred the memalloc scope from __mddev_suspend() */
+       memalloc_noio_restore(mddev->noio_flag);
+
+       percpu_ref_resurrect(&mddev->active_io);
+       wake_up(&mddev->sb_wait);
+
+       set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
+       md_wakeup_thread(mddev->thread);
+       md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */
+
+       mutex_unlock(&mddev->suspend_mutex);
+}
+EXPORT_SYMBOL_GPL(__mddev_resume);
+
 /*
  * Generic flush handling for md
  */
        mutex_init(&mddev->open_mutex);
        mutex_init(&mddev->reconfig_mutex);
        mutex_init(&mddev->sync_mutex);
+       mutex_init(&mddev->suspend_mutex);
        mutex_init(&mddev->bitmap_info.mutex);
        INIT_LIST_HEAD(&mddev->disks);
        INIT_LIST_HEAD(&mddev->all_mddevs);