Commit 092398dc authored by Heinz Mauelshagen's avatar Heinz Mauelshagen Committed by Shaohua Li

md: md.c: fix oops in mddev_suspend for raid0

Introduced by upstream commit 70d9798b

The raid0 personality does not create mddev->thread as oposed to
other personalities leading to its unconditional access in
mddev_suspend() causing an oops.

Patch checks for mddev->thread in order to keep the
intention of aforementioned commit.

Fixes: 70d9798b ("MD: warn for potential deadlock")
Cc: stable@vger.kernel.org (4.5+)
Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent bc47e842
...@@ -307,7 +307,7 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio) ...@@ -307,7 +307,7 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio)
*/ */
void mddev_suspend(struct mddev *mddev) void mddev_suspend(struct mddev *mddev)
{ {
WARN_ON_ONCE(current == mddev->thread->tsk); WARN_ON_ONCE(mddev->thread && current == mddev->thread->tsk);
if (mddev->suspended++) if (mddev->suspended++)
return; return;
synchronize_rcu(); synchronize_rcu();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment