archive mirror
 help / color / mirror / Atom feed
From: Tetsuo Handa <>
To: Christoph Hellwig <>, Jens Axboe <>,
	Milan Broz <>
Cc: Hillf Danton <>,
	Pavel Tatashin <>,
	"Reviewed-by : Tyler Hicks" <>,
Subject: Re: [PATCH 5/8] loop: merge the cryptoloop module into the main loop module
Date: Fri, 27 Aug 2021 20:33:10 +0900	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 2021/08/27 15:45, Christoph Hellwig wrote:
> On Thu, Aug 26, 2021 at 06:44:32PM +0200, Milan Broz wrote:
>> Yes, I know that removal is far disturbing thing here, if it
>> can be planned for removal later, I think it is the best thing to do...
>> And I would like to know actually if there are existing users
>> (and how and why they are using this interface - it cannot be configured
>> through losetup for years IIRC).
> We could just try to drop it entirely and see if anyone screams.  You
> are probably right that no one will.

I recommend that we only add a patch to deprecate cryptoloop module with
a printk() when people actually try to use cryptoloop module, and then
eventually remove cryptoloop module. But that is absolutely after my patches.

You are repeatedly failing to fix this problem because you are trying to fix
a different extra thing simply because you don't like the nasty locking interactions.

I posted "[PATCH v5] block: genhd: don't call probe function with major_names_lock held"
( ) for v5.14 (and also stable),
and "[PATCH] loop: replace loop_ctl_mutex with loop_idr_spinlock"
( ) for v5.15 (but not stable).

Any of your further series that claims to fix this problem is invalid
until you review and fully understand my patches. You are still missing what
the loop_ctl_mutex is serializing. The loop_ctl_mutex is used for serializing
"idr_alloc() + add_disk()" sequence versus "del_gendisk() + idr_remove()"

Your assumption in PATCH 7/8 is broken because idr_alloc() will succeed and
add_disk() will be called as soon as idr_remove() is called, and you wrongly
assumes that the Lo_deleting state can prevent further lookups. No, idr_remove()
cannot prevent further "idr_alloc() + add_disk()". In other words, idr_remove()
must not be called before del_gendisk() completes. That serialization is currently
handled by the loop_ctl_mutex, and my latter patch safely removes the loop_ctl_mutex
(at the risk of possibly changing the userspace's behavior; that's why my latter
patch is not for v5.14 but for v5.15. My former patch is for v5.14 because it has
no risk of possibly changing the userspace's behavior).

Don't try to merge the cryptoloop module into the loop module now; it makes
backporting the fix difficult. After applying my patches, applying your PATCH 1,2,3/8
will be OK as a cleanup, and your PATCH 4/8 would be OK given that several weeks
of testing are done in linux-next tree. But never your PATCH 5,6,7,8/8. You can't
fix this problem now if you try to do a different thing together.

  reply	other threads:[~2021-08-27 11:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26 13:38 sort out the lock order in the loop driver v2 Christoph Hellwig
2021-08-26 13:38 ` [PATCH 1/8] cryptoloop: fix a sparse annotation Christoph Hellwig
2021-08-26 13:38 ` [PATCH 2/8] loop: remove the unused idx argument to loop_control_get_free Christoph Hellwig
2021-08-26 13:38 ` [PATCH 3/8] loop: remove the ->ioctl method in loop_func_table Christoph Hellwig
2021-08-26 13:38 ` [PATCH 4/8] loop: return void from the ->release " Christoph Hellwig
2021-08-26 13:38 ` [PATCH 5/8] loop: merge the cryptoloop module into the main loop module Christoph Hellwig
2021-08-26 16:31   ` Milan Broz
2021-08-26 16:34     ` Christoph Hellwig
2021-08-26 16:44       ` Milan Broz
2021-08-27  6:45         ` Christoph Hellwig
2021-08-27 11:33           ` Tetsuo Handa [this message]
2021-08-27 15:38             ` Christoph Hellwig
2021-08-26 13:38 ` [PATCH 6/8] loop: devirtualize transfer transformations Christoph Hellwig
2021-08-26 13:38 ` [PATCH 7/8] loop: move loop device deletion out of loop_ctl_mutex Christoph Hellwig
2021-08-26 13:38 ` [PATCH 8/8] loop: avoid holding loop_ctl_mutex over add_disk Christoph Hellwig
2021-08-27  0:30 ` sort out the lock order in the loop driver v2 Tetsuo Handa
2021-08-27  6:40   ` Christoph Hellwig
2021-08-27  7:46     ` Tetsuo Handa
2021-08-27 15:34       ` Christoph Hellwig
     [not found] ` <>
2021-08-27 14:10   ` Tetsuo Handa
     [not found]   ` <>
2021-08-28  5:17     ` Tetsuo Handa

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).