linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] Loopback devices with 4k logical block size are not automatically scanned for GPT partitions
@ 2018-08-08 23:30 Andrew Jeddeloh
  2018-08-09  8:10 ` Ming Lei
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Jeddeloh @ 2018-08-08 23:30 UTC (permalink / raw)
  To: linux-kernel

I think I found a bug with partition scanning/loopback devices with 4k
logical sectors. It affects 4.14.x and 4.17.x kernels (and presumably
others). I've also filed the bug on the kernel bugzilla:

https://bugzilla.kernel.org/show_bug.cgi?id=200749

Copied from the bugzilla report:

Loop devices with the logical sector size set to 4096 do not
autodetect partitions when attached. It may be the case for devices
with 4k logical sectors in general, but I do not have hardware to test
that. I have not tested with non-GPT disks.

I expect to see /dev/loopNpX devices appear when attaching a loopback
device with partitions, regardless of logical block size. With 4096
byte logical block size I only see /dev/loopN devices and no
/dev/loopNpX devices.

Steps to reproduce:
1) truncate -s 1G diskimg
2) losetup -fP --show -b 4096 diskimg
3) sgdisk -n 0:0:0 /dev/loopN # Other partitioning tools will probably
also work.
4) losetup -d /dev/loopN
5) losetup -fP --show -b 4096 diskimg

This happens reliably. I can reproduce it 100% of the time.

Running `sgdisk -p /dev/loopN` with trigger a partition scan and it
find the partitions correctly then, but they do not appear when
initially attached with `losetup -P`. Disk images with logical block
size 512 do appear correctly.

I've tested this with a Fedora 4.17.x kernel, my gentoo 4.17.x kernel
and a Container linux 4.14.x kernel; they all exhibit the same
behavior.

I don't see anything interesting in dmesg and udevadm monitor shows
there are no ADD uevents for the partition block devices until `sgdisk
-p /dev/loopN` is run.

Let me know if there's any other information you want.
Also please CC me in replies. I am not subscribed to the list in general

 - Andrew Jeddeloh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] Loopback devices with 4k logical block size are not automatically scanned for GPT partitions
  2018-08-08 23:30 [BUG] Loopback devices with 4k logical block size are not automatically scanned for GPT partitions Andrew Jeddeloh
@ 2018-08-09  8:10 ` Ming Lei
  2018-08-10 19:33   ` Andrew Jeddeloh
  0 siblings, 1 reply; 3+ messages in thread
From: Ming Lei @ 2018-08-09  8:10 UTC (permalink / raw)
  To: Andrew Jeddeloh; +Cc: Linux Kernel Mailing List, linux-block

On Thu, Aug 9, 2018 at 7:30 AM, Andrew Jeddeloh
<andrew.jeddeloh@redhat.com> wrote:
> I think I found a bug with partition scanning/loopback devices with 4k
> logical sectors. It affects 4.14.x and 4.17.x kernels (and presumably
> others). I've also filed the bug on the kernel bugzilla:
>
> https://bugzilla.kernel.org/show_bug.cgi?id=200749
>
> Copied from the bugzilla report:
>
> Loop devices with the logical sector size set to 4096 do not
> autodetect partitions when attached. It may be the case for devices
> with 4k logical sectors in general, but I do not have hardware to test
> that. I have not tested with non-GPT disks.

You may setup 4k sector-size with scsi_debug or qemu virtio-scsi,
then try to reproduce on these devices.

Cc block list.


Thanks,
Ming Lei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] Loopback devices with 4k logical block size are not automatically scanned for GPT partitions
  2018-08-09  8:10 ` Ming Lei
@ 2018-08-10 19:33   ` Andrew Jeddeloh
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Jeddeloh @ 2018-08-10 19:33 UTC (permalink / raw)
  To: Ming Lei; +Cc: Linux Kernel Mailing List, linux-block

I tried with qemu virtio-blk-pci (couldn't find a qemu option for
logical or physical block size for virtio-scsi-pci) and it found the
partition when booting. I see

virtio_blk virtio1: [vdb] 262144 4096-byte logical blocks (1.07 GB/1.00 GiB)

quickly followed by

 vdb: vdb1

on dmesg on bootup. I haven't tried hotplugging it yet. I don't know
if that would matter.

 - Andrew Jeddeloh

On Thu, Aug 9, 2018 at 1:10 AM, Ming Lei <tom.leiming@gmail.com> wrote:
> On Thu, Aug 9, 2018 at 7:30 AM, Andrew Jeddeloh
> <andrew.jeddeloh@redhat.com> wrote:
>> I think I found a bug with partition scanning/loopback devices with 4k
>> logical sectors. It affects 4.14.x and 4.17.x kernels (and presumably
>> others). I've also filed the bug on the kernel bugzilla:
>>
>> https://bugzilla.kernel.org/show_bug.cgi?id=200749
>>
>> Copied from the bugzilla report:
>>
>> Loop devices with the logical sector size set to 4096 do not
>> autodetect partitions when attached. It may be the case for devices
>> with 4k logical sectors in general, but I do not have hardware to test
>> that. I have not tested with non-GPT disks.
>
> You may setup 4k sector-size with scsi_debug or qemu virtio-scsi,
> then try to reproduce on these devices.
>
> Cc block list.
>
>
> Thanks,
> Ming Lei

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-10 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-08 23:30 [BUG] Loopback devices with 4k logical block size are not automatically scanned for GPT partitions Andrew Jeddeloh
2018-08-09  8:10 ` Ming Lei
2018-08-10 19:33   ` Andrew Jeddeloh

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).