From: Christoph Hellwig <hch@lst.de>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
Josef Bacik <josef@toxicpanda.com>,
Minchan Kim <minchan@kernel.org>, Nitin Gupta <ngupta@vflare.org>,
Jan Kara <jack@suse.cz>, "Darrick J . Wong" <djwong@kernel.org>,
Ming Lei <ming.lei@redhat.com>,
Matteo Croce <mcroce@microsoft.com>,
linux-block@vger.kernel.org, nbd@other.debian.org
Subject: Re: [PATCH 13/14] loop: remove lo_refcount and avoid lo_mutex in ->open / ->release
Date: Tue, 29 Mar 2022 08:52:34 +0200 [thread overview]
Message-ID: <20220329065234.GA20006@lst.de> (raw)
In-Reply-To: <03628e13-ca56-4ed0-da5a-ee698c83f48d@I-love.SAKURA.ne.jp>
Hi Tetsuo,
I'm a bit confused. Partially due to the two patches in one mail, but
also because I can't actually find a try that they cleanly apply to.
But let me add my thoughts here:
- I think the change
On Sat, Mar 26, 2022 at 11:52:36AM +0900, Tetsuo Handa wrote:
> Since __loop_clr_fd() is currently holding loop_validate_mutex and lo->lo_mutex,
> "avoid lo_mutex in ->release" part is incomplete.
>
> The intent of holding loop_validate_mutex (which causes disk->open_mutex =>
> loop_validate_mutex => lo->lo_mutex => blk_mq_freeze_queue()/blk_mq_unfreeze_queue()
> chain) is to make loop_validate_file() traversal safe.
>
> Since ->release is called with disk->open_mutex held, and __loop_clr_fd() from
> lo_release() is called via ->release when disk_openers() == 0, we are guaranteed
> that "struct file" which will be passed to loop_validate_file() via fget() cannot
> be the loop device __loop_clr_fd(lo, true) will clear. Thus, there is no need to
> hold loop_validate_mutex and lo->lo_mutex from __loop_clr_fd() if release == true.
This part looks reasonable. Can you give a signoff and proper commit
log and I'll slot it in before the lo_refcount removal.
next prev parent reply other threads:[~2022-03-29 6:52 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-25 6:39 yet another approach to fix the loop lock order inversions v5 Christoph Hellwig
2022-03-25 6:39 ` [PATCH 01/14] nbd: use the correct block_device in nbd_bdev_reset Christoph Hellwig
2022-03-25 9:48 ` Jan Kara
2022-03-25 6:39 ` [PATCH 02/14] zram: cleanup reset_store Christoph Hellwig
2022-03-25 6:39 ` [PATCH 03/14] zram: cleanup zram_remove Christoph Hellwig
2022-03-25 6:39 ` [PATCH 04/14] block: add a disk_openers helper Christoph Hellwig
2022-03-25 6:39 ` [PATCH 05/14] block: turn bdev->bd_openers into an atomic_t Christoph Hellwig
2022-03-25 6:39 ` [PATCH 06/14] loop: de-duplicate the idle worker freeing code Christoph Hellwig
2022-03-25 6:39 ` [PATCH 07/14] loop: initialize the worker tracking fields once Christoph Hellwig
2022-03-25 6:39 ` [PATCH 08/14] loop: remove the racy bd_inode->i_mapping->nrpages asserts Christoph Hellwig
2022-03-25 6:39 ` [PATCH 09/14] loop: don't freeze the queue in lo_release Christoph Hellwig
2022-03-25 6:39 ` [PATCH 10/14] loop: only freeze the queue in __loop_clr_fd when needed Christoph Hellwig
2022-03-25 6:39 ` [PATCH 11/14] loop: implement ->free_disk Christoph Hellwig
2022-03-25 10:42 ` Tetsuo Handa
2022-03-25 15:10 ` Tetsuo Handa
2022-03-25 6:39 ` [PATCH 12/14] loop: suppress uevents while reconfiguring the device Christoph Hellwig
2022-03-25 9:49 ` Jan Kara
2022-03-25 6:39 ` [PATCH 13/14] loop: remove lo_refcount and avoid lo_mutex in ->open / ->release Christoph Hellwig
2022-03-26 2:52 ` Tetsuo Handa
2022-03-29 6:52 ` Christoph Hellwig [this message]
2022-03-29 13:25 ` Christoph Hellwig
2022-03-29 14:02 ` Tetsuo Handa
2022-03-29 14:49 ` Christoph Hellwig
2022-03-25 6:39 ` [PATCH 14/14] loop: don't destroy lo->workqueue in __loop_clr_fd Christoph Hellwig
2022-03-29 15:36 ` [PATCH 15/14] loop: avoid loop_validate_mutex/lo_mutex in ->release Tetsuo Handa
2022-03-30 8:14 ` Jan Kara
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=20220329065234.GA20006@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=djwong@kernel.org \
--cc=jack@suse.cz \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=mcroce@microsoft.com \
--cc=minchan@kernel.org \
--cc=ming.lei@redhat.com \
--cc=nbd@other.debian.org \
--cc=ngupta@vflare.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/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.