public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Derek Basehore <dbasehore@chromium.org>
Cc: linux-kernel@vger.kernel.org, axboe@kernel.dk, msb@chromium.orq,
	bleung@chromium.org, taysom@chromium.org
Subject: Re: [PATCH v2 1/2] block: Remove deadlock in disk_clear_events
Date: Wed, 21 Nov 2012 00:31:51 -0800	[thread overview]
Message-ID: <20121121003151.0d125ef5.akpm@linux-foundation.org> (raw)
In-Reply-To: <1353377222-19541-1-git-send-email-dbasehore@chromium.org>

On Mon, 19 Nov 2012 18:07:01 -0800 Derek Basehore <dbasehore@chromium.org> wrote:

> In disk_clear_events, do not put work on system_nrt_freezable_wq. Instead, put
> it on system_nrt_wq.
> 
> There is a race between probing a usb and suspending the device. Since probing a
> usb calls disk_clear_events, which puts work on a frozen workqueue, probing
> cannot finish after the workqueue is frozen. However, suspending cannot finish
> until the usb probe is finished, so we get a deadlock.

um,

- this is identical to v1

- ten days ago Jens said "thanks, applied" to v1, but it isn't in linux-next.

- At that time Jens asked you whether a -stable backport was
  warranted but I see no reply on that topic.

> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1571,7 +1571,13 @@ unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask)
>  
>  	/* uncondtionally schedule event check and wait for it to finish */
>  	disk_block_events(disk);
> -	queue_delayed_work(system_freezable_wq, &ev->dwork, 0);
> +	/* We need to put the work on system_nrt_wq here since there is a

Like this:

	/*
	 * We need to ...

> +	 * deadlock that happens while probing a usb device while suspending. If
> +	 * we put work on a freezable worqueue here, a usb probe will wait here

s/worqueue/workqueue/

> +	 * until the workqueue is unfrozen during suspend. Since suspend waits
> +	 * on all probes to complete, we have a deadlock
> +	 */
> +	queue_delayed_work(system_nrt_wq, &ev->dwork, 0);
>  	flush_delayed_work(&ev->dwork);
>  	__disk_unblock_events(disk, false);


      parent reply	other threads:[~2012-11-21  8:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20  2:07 [PATCH v2 1/2] block: Remove deadlock in disk_clear_events Derek Basehore
2012-11-20  2:07 ` [PATCH v2 2/2] block: prevent race/cleanup Derek Basehore
2012-11-21  8:31 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121121003151.0d125ef5.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=bleung@chromium.org \
    --cc=dbasehore@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=msb@chromium.orq \
    --cc=taysom@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox