On Mon, Feb 13, 2023 at 08:41:35AM +0000, Arvin Schnell wrote: > On Thu, Feb 09, 2023 at 05:18:56PM -0800, Brian C. Lane wrote: > > > The benefit of this is that you can now easily read the device without > > triggering any udev events with: > > > > parted --script --readonly /dev/sda u s p free > > This does not work on Linux if there are partitions that are not > mounted. In that case _flush_cache still opens the partitions in > WRONLY mode thus triggering udev. The problem seems to be that > while _device_open gets the flags correctly (from > _device_open_ro), _flush_cache looks at dev->read_only.
Good catch. I was testing it on a disk.img file and a disk with mounted partitions and didn't see that. It looks like the path there is through the initial probe, using _device_open_ro(), and the reason the _flush_cache is there is because of commit fb99ba5e which says it was sometimes mis-identifying a new filesystem because the cache hadn't been flushed yet. So I don't think there is any way to prevent that, it needs to flush it to make sure it has the latest data. I think this patchset is an improvement over the other options, but I'm not totally convinced it matters if it can't keep all the events from happening. Brian -- Brian C. Lane (PST8PDT) - weldr.io - lorax - parted - pykickstart
