In the Linux kernel, the following vulnerability has been resolved: md: call __mdstopwrites in md_stop From the link [1], we can see raid1d was running even after the path raiddtr -> mdstop -> __mdstop. Let's stop write first in destructor to align with normal md-raid to fix the KASAN issue. [1]. https://lore.kernel.org/linux-raid/CAPhsuW5gc4AakdGNdF8ubpezAuDLFOYUOsfMZcec6hQFm8nhg@mail.gmail.com/T/#m7f12bf90481c02c6d2da68c64aeed4779b7df74a