[parted-devel] [PATCH] Should we flock while we have the device open for RW?

Brian C. Lane bcl at redhat.com
Tue Aug 11 20:49:06 UTC 2015


This is in addition to the read only open patch I posted last week. In my
testing it appears to work just fine, but I'm more nervous about this patch
causing problems with other users of the device node since it would be locked
for the lifetime of the process.

What are people's thoughts on this?

It would prevent other instances of libparted from interfering (they would
block) and it would help reduce problem with udev races. udev opens it with
flock(fd_lock, LOCK_SH|LOCK_NB) so it would block until parted is finished.

Brian C. Lane (1):
  libparted: Use flock to lock access to the device

 libparted/arch/linux.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

-- 
2.4.3




More information about the parted-devel mailing list