All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
To: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>
Cc: Jan Kara <jack@suse.cz>,
	Dan Schatzberg <schatzberg.dan@gmail.com>,
	linux-block@vger.kernel.org
Subject: Re: [PATCH 1/2] loop: use a global workqueue
Date: Thu, 23 Dec 2021 23:37:21 +0900	[thread overview]
Message-ID: <bb151d84-8a56-f6da-a5dd-b2d8d1fb6cdb@i-love.sakura.ne.jp> (raw)
In-Reply-To: <20211223112509.1116461-2-hch@lst.de>

On 2021/12/23 20:25, Christoph Hellwig wrote:
> Using a per-device unbound workqueue is a bit of an anti-pattern and
> in this case also creates lock ordering problems.  Just use a global
> concurrency managed workqueue instead.

Use of a global workqueue for the loop driver itself is fine. But

> @@ -1115,7 +1107,6 @@ static void __loop_clr_fd(struct loop_device *lo)
>  	/* freeze request queue during the transition */
>  	blk_mq_freeze_queue(lo->lo_queue);
>  
> -	destroy_workqueue(lo->workqueue);

is it safe to remove destroy_workqueue() call here?

>  	spin_lock_irq(&lo->lo_work_lock);
>  	list_for_each_entry_safe(worker, pos, &lo->idle_worker_list,
>  				idle_list) {

destroy_workqueue() implies flush_workqueue() which is creating the lock
ordering problem. And I think that flush_workqueue() is required for making
sure that there is no more work to process (i.e. loop_process_work() is
no longer running) before start deleting idle workers.

My understanding is that the problem is not the use of a per-device workqueue
but the need to call flush_workqueue() in order to make sure that all pending
works are completed.


  reply	other threads:[~2021-12-23 14:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-23 11:25 fix loop autoclear for xfstets xfs/049 Christoph Hellwig
2021-12-23 11:25 ` [PATCH 1/2] loop: use a global workqueue Christoph Hellwig
2021-12-23 14:37   ` Tetsuo Handa [this message]
2021-12-24  6:03     ` Christoph Hellwig
2021-12-24 12:05       ` Tetsuo Handa
2021-12-24 14:05         ` Tetsuo Handa
2021-12-29 17:21         ` Christoph Hellwig
2021-12-29  2:23   ` Tetsuo Handa
2021-12-23 11:25 ` [PATCH 2/2] loop: make autoclear operation synchronous again Christoph Hellwig
2021-12-23 13:40 ` fix loop autoclear for xfstets xfs/049 Jan Kara
2021-12-24  6:02   ` Christoph Hellwig
2021-12-26  7:09     ` Tetsuo Handa
2021-12-29 17:20       ` Christoph Hellwig

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=bb151d84-8a56-f6da-a5dd-b2d8d1fb6cdb@i-love.sakura.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=schatzberg.dan@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.