2018-02-15 13:51:10

by Julien Durillon

[permalink] [raw]
Subject: [BUG? NVME Linux-4.15] Dracut loops indefinitely with 4.15

Hi there,

I opened an issue here:
https://github.com/dracutdevs/dracut/issues/373 for dracut. You can
read there how dracuts enters an infinite loop.

TL;DR: in linux-4.14, trying to find the last "slave" of /dev/dm-0
ends with a maj:min of "249:0" which does not exist in /sys/dev/block.
In linux-4.15, the same thing loops as "249:0" exists.

## My configuration

I'm using a nvme ssd disk named "nvme0n1". It has two partitions: an
EFI one and a luks encrypted btrfs volume. So in /dev I have /dev/dm-0
that is referenced to by /dev/mapper/root.
/dev/mapper/root -> /dev/dm-0 is the mapped un-encrypted
"/dev/nvme0n1p2" volume used as a btrfs volume.

## My problem

*Before* linux-4.15, `stat /dev/dm-0` displays:

File: /dev/dm-0
Size: 0 Blocks: 0 IO Block: 4096 block special file
Device: 6h/6d Inode: 2768 Links: 1 Device type: fa,0
Access: (0660/brw-rw----) Uid: ( 0/ root) Gid: ( 6/ disk)
Access: 2018-02-12 17:49:46.020513274 +0100
Modify: 2018-02-12 17:49:46.020513274 +0100
Change: 2018-02-12 17:49:46.020513274 +0100
Birth: -

So the device type is "fa,0", which is translated by dracut as "250:0".

*Starting at* linux-4.15, `stat /dev/dm-0` displays:

File: /dev/dm-0
Size: 0 Blocks: 0 IO Block: 4096 block special file
Device: 6h/6d Inode: 17795 Links: 1 Device type: f9,0
Access: (0660/brw-rw----) Uid: ( 0/ root) Gid: ( 6/ disk)
Access: 2018-02-15 14:38:56.570529189 +0100
Modify: 2018-02-15 14:38:56.570529189 +0100
Change: 2018-02-15 14:38:56.570529189 +0100
Birth: -

So the device type is "f9,0", which is translated by dracut as "249:0".

I'm posting it here because I don't understand why the kernel changed
the device type. Is it intended?

Regards,
--
Julien Durillon


2018-02-16 16:48:49

by Keith Busch

[permalink] [raw]
Subject: Re: [BUG? NVME Linux-4.15] Dracut loops indefinitely with 4.15

On Thu, Feb 15, 2018 at 02:49:56PM +0100, Julien Durillon wrote:
> I opened an issue here:
> https://github.com/dracutdevs/dracut/issues/373 for dracut. You can
> read there how dracuts enters an infinite loop.
>
> TL;DR: in linux-4.14, trying to find the last "slave" of /dev/dm-0
> ends with a maj:min of "249:0" which does not exist in /sys/dev/block.
> In linux-4.15, the same thing loops as "249:0" exists.

The problem is dracut assumes the 'dev' file for an nvme namespace's
parent device contains a maj:min for a block device. It's actually a
character device, and its maj:min happens to also be be the same as the
device mapper's block device.

2018-02-16 17:40:18

by Julien Durillon

[permalink] [raw]
Subject: Re: [BUG? NVME Linux-4.15] Dracut loops indefinitely with 4.15

2018-02-15 21:19 GMT+01:00 Keith Busch <[email protected]>:
> The problem is dracut assumes the 'dev' file for an nvme namespace's
> parent device contains a maj:min for a block device. It's actually a
> character device, and its maj:min happens to also be be the same as the
> device mapper's block device.

So dracut should see that it's a character device and not a block device?

--
Julien Durillon