From: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
To: Jens Axboe <axboe@kernel.dk>, Martijn Coenen <maco@android.com>,
Alyssa Ross <hi@alyssa.is>
Cc: "John Ogness" <john.ogness@linutronix.de>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Subject: [PATCH] loop: Properly send KOBJ_CHANGED uevent for disk device
Date: Mon, 17 Mar 2025 15:13:25 +0100 [thread overview]
Message-ID: <20250317-loop-uevent-changed-v1-1-cb29cb91b62d@linutronix.de> (raw)
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);
return error;
out_err:
@@ -1115,8 +1115,8 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
if (partscan)
clear_bit(GD_SUPPRESS_PART_SCAN, &lo->lo_disk->state);
- /* 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);
loop_global_unlock(lo, is_loop);
if (partscan)
---
base-commit: 4701f33a10702d5fc577c32434eb62adde0a1ae1
change-id: 20250307-loop-uevent-changed-aa3690f43e03
Best regards,
--
Thomas Weißschuh <thomas.weissschuh@linutronix.de>
next reply other threads:[~2025-03-17 14:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-17 14:13 Thomas Weißschuh [this message]
2025-03-17 14:33 ` Greg KH
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=20250317-loop-uevent-changed-v1-1-cb29cb91b62d@linutronix.de \
--to=thomas.weissschuh@linutronix.de \
--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 \
/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
all inboxes | Powered by JetHome®