From: Simon Richter <Simon.Richter@hogyros.de>
To: linux-block@vger.kernel.org
Subject: fast creation and deletion of loop devices
Date: Thu, 8 Jul 2021 14:18:41 +0200 [thread overview]
Message-ID: <20210708121841.GA228715@psi5.com> (raw)
Hi,
I have just used a crude loop to search for a partition on a block
device:
for i in `seq 1 4096`
do
losetup -r -o ${i}k /dev/loop0 /dev/sda
mount /dev/loop0 /mnt && break
losetup -d /dev/loop0
done
Creating the loop device fails sometimes, with
losetup: /dev/sda: failed to set up loop device: Device or resource busy
and the kernel log contains a few instances of
loop_set_status: loop0 () has still dirty pages (nrpages=5)
My machine is now in a state where I can call
until losetup -d /dev/loop0; do :; done
and the loop just keeps running.
I'm slightly confused why a read-only loop device would have dirty pages
in the first place, and I suspect that there is a kernel bug here that
allows me to enter an inconsistent state through a race condition if I
just attach and detach loop devices fast enough.
Simon
reply other threads:[~2021-07-08 12:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210708121841.GA228715@psi5.com \
--to=simon.richter@hogyros.de \
--cc=linux-block@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 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.