On Tue, Nov 19, 2024 at 1:00 AM Lennart Poettering <lennart@xxxxxxxxxxxxxx> wrote: > > On Do, 14.11.24 14:25, Phillip Susi (phill@xxxxxxxxxxxx) wrote: > > > Lennart Poettering <lennart@xxxxxxxxxxxxxx> writes: > > > > > the BLKFLSBUF ioctl() works fine on block device fds open for read only. > > > > Oh, I might have to change that to use a read only open then. > > > > > I am not following anymore. As *long* *as* *the* lock is taken the > > > auto mounting doesn't happen. Once you release the lock then > > > everything will be reprobed and work as it always worked, including > > > auto-mounting. > > > > It is not about delaying the auto mounting, but *preventing it* > > entirely. > > It *is* prevented. While you keep the lock open *no* events are > propagated from udev to its clients, hence no automounts will take > place. Any kernel reported event that happen while you keep the lock > will basically be eaten up by udev and not propagated on to rest of > userspace. They are sent to /dev/null if you so will. When you release > the lock once you are fully done (which might as well be 3h later, if > you like) however, then a single *new* event is *synthesized*, to get > the rest of userspace updated again on things. And yes, that *might* > cause userspace to automount things, and other stuff. But that's fine, > you explicit indicated you are now done with the device, hence others > can consume it again. I think you have been talking past each other for the last dozen mails. I am quite sure that Philip Susi not only wants to prevent auto-mounts while gparted is working with the filesystem but also afterwards, i.e. they also want to suppress the synthetic event you are talking about. > Or in other words: if you must, just take the frickin' lock the > *entire* time gparted runs, and nothing else will automount or > otherwise touch device while gparted runs. > > Hence, again: just take the frickin' lock. It's the API you should be > using. Don't mask units or anything, that's entirely besides the > point and seriously broken. > > Did I get through now? I really fail to see why the concept of a lock > is so difficult to grok? > > Lennart > > -- > Lennart Poettering, Berlin