Subject: bug#25756: Problems using "parted ... print" on nvme devices

From: "Brian C. Lane" <[email-masked]>
Date: Thu, 16 Feb 2017 09:32:18 -0800

On Thu, Feb 16, 2017 at 09:08:44AM -0600, Douglas Miller wrote:
> We have seen a problem in some test infrastructure that uses "parted ...
> print" to query partition information and then configure test cases. The
> problem shows up when using parted on nvme drives because systemd.udevd is
> monitoring nvme devices for changes to the partition tables, and rebuilds
> the devices. This results in the devices disappearing for a few seconds
> after running "parted ... print" and causing failures to configure tests.
> The root cause is that parted opens the device "O_RDWR" regardless of
> whether it is actually modifying the partition table, and this notifies
> systemd-udevd causing the disruption in the block devices.
> 
> I have not worked up a patch yet, or even studied the code in-depth, but it
> seems to me that parted could be better about using open modes that reflect
> it's true intentions. Does that seem like a reasonable change?
> 
> I expect that our test infrastructure will have to be modified, probably to
> use fdisk or something other than parted, but it still seems like something
> to be fixed.

I think the tricky part of that is going to be that when we open the
device we don't really know what commands are going to be issued so it
needs to be RDWR to allow for all the other possibilities.

There should be some way to lock out udev during your tests.

-- 
Brian C. Lane (PST8PDT)