util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francis Moreau <francis.moro@gmail.com>
To: "Dale R. Worley" <worley@alum.mit.edu>, util-linux@vger.kernel.org
Subject: Re: losetup on a image file containing (GPT) partition doesn't create partition devices
Date: Sat, 04 Oct 2014 21:35:31 +0200	[thread overview]
Message-ID: <54304C03.6020309@gmail.com> (raw)
In-Reply-To: <542F065C.2080505@gmail.com>

On 10/03/2014 10:26 PM, Francis Moreau wrote:
> On 10/03/2014 09:58 PM, Dale R. Worley wrote:
>>> From: worley@alum.mit.edu (Dale R. Worley)
>>
>>> Then I detached the loopback device, re-attached it, and this time,
>>> the partition devices were *not* created, and /var/log/messages did
>>> not have the "loop0: p1 p2" message.
>>>
>>> Given that the message starts "kernel:", I suspect that the udev
>>> behavior is triggered by the kernel detecting the partition table, and
>>> that is not happening.  So it looks like it's a kernel bug.
>>
>> I tried that again, after updating to kernel 3.14.19-100.fc19.x86_64,
>> and it worked this time.
> 
> Well I'm already running 3.14.18, and the problem is still present but
> not systematic.
> 
> Here's a script which should trigger the problem:
> 
> -----
> while :; do
> 
>     losetup -P /dev/loop0 disk.raw ||
>     exit
> 
>     test -e /dev/loop0p1 || {
>         echo "missing loop partition"
>         losetup -d /dev/loop0
>         break
>     }
>     echo -n "losetup worked: "
>     ls /dev/loop0*
> 
>     losetup -d /dev/loop0 ||
>     exit
> 
>     sleep 1
> done
> ----
> 
> After looking at the kernel code, the kernel can silently fail to scan
> the partition table. This can happen if another process is already using
> the device and I think udev is the process that can interfere with
> 'losetup -P'.
> 
> What do you think ?

Ok, so IMHO I think that losetup(8) should issue its own
ioctl(BLKRRPART) and shouldn't rely on the kernel during the loop setup
since it can fail silently. This way it can check the return value of
ioctl() and moght choose to do it again in case the return value is -EBUSY.

Or indicates in the man page that the -P can fail silently.

Thanks


  reply	other threads:[~2014-10-04 19:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-03  9:44 losetup on a image file containing (GPT) partition doesn't create partition devices Francis Moreau
2014-10-03 14:29 ` Dale R. Worley
2014-10-03 19:58   ` Dale R. Worley
2014-10-03 20:26     ` Francis Moreau
2014-10-04 19:35       ` Francis Moreau [this message]
2014-10-06 15:47         ` Dale R. Worley
2014-10-06 15:56           ` Francis Moreau
2014-10-27 20:16             ` Mike Frysinger
2014-12-02 19:29               ` Phillip Susi
2014-12-03  8:36                 ` Karel Zak
2014-12-03 14:49                   ` Phillip Susi
2014-12-03 16:10                     ` Karel Zak
2015-02-16  8:52                 ` Mike Frysinger

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=54304C03.6020309@gmail.com \
    --to=francis.moro@gmail.com \
    --cc=util-linux@vger.kernel.org \
    --cc=worley@alum.mit.edu \
    /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;
as well as URLs for NNTP newsgroup(s).