From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Petr Vorel <pvorel@suse.cz>, Martijn Coenen <maco@android.com>,
linux-block@vger.kernel.org, ltp@lists.linux.it
Subject: [PATCH 2/2] loop: Fix occasional uevent drop
Date: Thu, 12 Nov 2020 17:50:05 +0100 [thread overview]
Message-ID: <20201112165005.4022502-3-hch@lst.de> (raw)
In-Reply-To: <20201112165005.4022502-1-hch@lst.de>
From: Petr Vorel <pvorel@suse.cz>
Commit 716ad0986cbd ("loop: Switch to set_capacity_revalidate_and_notify")
causes an occasional drop of loop device uevent, which are no longer
triggered in loop_set_size() but in a different part of code.
Bug is reproducible with LTP test uevent01 [1]:
i=0; while true; do
i=$((i+1)); echo "== $i =="
lsmod |grep -q loop && rmmod -f loop
./uevent01 || break
done
Put back triggering through code called in loop_set_size().
Fix required to add yet another parameter to
set_capacity_revalidate_and_notify().
[1] https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/uevents/uevent01.c
Fixes: 716ad0986cbd ("loop: Switch to set_capacity_revalidate_and_notify")
Reported-by: <ltp@lists.linux.it>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
[hch: rebased on a different change to the prototype of
set_capacity_revalidate_and_notify]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/loop.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index cb1191d6e945f2..a58084c2ed7ceb 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -255,7 +255,8 @@ static void loop_set_size(struct loop_device *lo, loff_t size)
bd_set_nr_sectors(bdev, size);
- set_capacity_revalidate_and_notify(lo->lo_disk, size, false);
+ if (!set_capacity_revalidate_and_notify(lo->lo_disk, size, false))
+ kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
}
static inline int
--
2.28.0
next prev parent reply other threads:[~2020-11-12 16:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 16:50 loop uevent fix Christoph Hellwig
2020-11-12 16:50 ` [PATCH 1/2] block: add a return value to set_capacity_revalidate_and_notify Christoph Hellwig
2020-11-12 19:13 ` Petr Vorel
2020-11-12 16:50 ` Christoph Hellwig [this message]
2020-11-12 19:25 ` [PATCH 2/2] loop: Fix occasional uevent drop Petr Vorel
2020-11-12 19:31 ` loop uevent fix Petr Vorel
2020-11-12 20:59 ` Jens Axboe
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=20201112165005.4022502-3-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=ltp@lists.linux.it \
--cc=maco@android.com \
--cc=pvorel@suse.cz \
/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