Merge tag 'for-4.15/dm-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[muen/linux.git] / drivers / md / dm-raid.c
index ea6eb96b50121e5ccd7a93211ac270615d3cbab2..6319d846e0adb8c264f98676f0c2ddb8e85bdbb7 100644 (file)
@@ -12,7 +12,7 @@
 #include "raid1.h"
 #include "raid5.h"
 #include "raid10.h"
-#include "bitmap.h"
+#include "md-bitmap.h"
 
 #include <linux/device-mapper.h>
 
@@ -3624,8 +3624,11 @@ static void raid_postsuspend(struct dm_target *ti)
 {
        struct raid_set *rs = ti->private;
 
-       if (!test_and_set_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags))
+       if (!test_and_set_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags)) {
+               mddev_lock_nointr(&rs->md);
                mddev_suspend(&rs->md);
+               mddev_unlock(&rs->md);
+       }
 
        rs->md.ro = 1;
 }
@@ -3882,8 +3885,11 @@ static void raid_resume(struct dm_target *ti)
        if (!(rs->ctr_flags & RESUME_STAY_FROZEN_FLAGS))
                clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
 
-       if (test_and_clear_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags))
+       if (test_and_clear_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags)) {
+               mddev_lock_nointr(mddev);
                mddev_resume(mddev);
+               mddev_unlock(mddev);
+       }
 }
 
 static struct target_type raid_target = {