Subject: Problems using "parted ... print" on nvme devices

From: Douglas Miller <[email-masked]>
Date: Thu, 16 Feb 2017 09:08:44 -0600

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.

Thoughts?

Thanks,

Doug