From: Greg KH <greg@kroah.com>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Cc: Jens Axboe <axboe@kernel.dk>, Martijn Coenen <maco@android.com>,
Alyssa Ross <hi@alyssa.is>,
John Ogness <john.ogness@linutronix.de>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] loop: Properly send KOBJ_CHANGED uevent for disk device
Date: Mon, 17 Mar 2025 15:33:55 +0100 [thread overview]
Message-ID: <2025031759-unlined-candle-1d91@gregkh> (raw)
In-Reply-To: <20250317-loop-uevent-changed-v1-1-cb29cb91b62d@linutronix.de>
On Mon, Mar 17, 2025 at 03:13:25PM +0100, Thomas Weißschuh wrote:
> The wording "uncork" in the code comment indicates that it is expected that
> the suppressed event instances are automatically sent after unsuppressing.
> This is not the case, they are discarded.
> In effect this means that no "changed" events are emitted on the device
> itself by default. On the other hand each discovered partition does trigger
> a "changed" event on the loop device itself. Therefore no event is emitted for
> devices without partitions.
>
> This leads to udev missing the device creation and prompting workarounds in
> userspace, see the linked util-linux/losetup bug.
>
> Explicitly emit the events and drop the confusingly worded comments.
>
> Link: https://github.com/util-linux/util-linux/issues/2434
> Fixes: 3448914e8cc5 ("loop: Add LOOP_CONFIGURE ioctl")
> Cc: stable@vger.kernel.org
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> drivers/block/loop.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index c05fe27a96b64f1f1ea3868510fdd0c7f4937f55..fbc67ff29e07c15f2e3b3e225a4a37df016fe9de 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -654,8 +654,8 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
>
> error = 0;
> done:
> - /* enable and uncork uevent now that we are done */
> dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 0);
> + kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE);
Why not just remove the place where the uevent was suppressed to start
with? It feels by manually sending a change event, you are doing
exactly what the suppress was trying to prevent, which makes me think
this is wrong.
thanks,
greg k-h
next prev parent reply other threads:[~2025-03-17 14:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-17 14:13 [PATCH] loop: Properly send KOBJ_CHANGED uevent for disk device Thomas Weißschuh
2025-03-17 14:33 ` Greg KH [this message]
2025-04-04 9:18 ` Thomas Weißschuh
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=2025031759-unlined-candle-1d91@gregkh \
--to=greg@kroah.com \
--cc=axboe@kernel.dk \
--cc=hi@alyssa.is \
--cc=john.ogness@linutronix.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maco@android.com \
--cc=stable@vger.kernel.org \
--cc=thomas.weissschuh@linutronix.de \
/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