On Sat, 2019-02-02 at 14:34 +0100, Samuel Thibault wrote: > Hello, > So can you confirm my guesswork above? If, so, then only keep the first > line (the second line doesn't make sense in my guesswork), and mention > that while fcntl requires WR access for exclusive lock, flock doesn't.
I've now run the tests for flock: ./test-flock ./test-flock: Usage: ./test-flock file [flags] [operation] [sleep_time] file : file name/device name flags : r (O_RDONLY) | w [O_WRONLY] | rw (O_RDWR) operation : s [LOCK_SH], x (LOCK_EX), u (LOCK_UN), sn (LOCK_SH | LOCK_UN), xn (LOCK_EX | LOCK_UN) sleep_time : st <number>[10] GNU/Linux and GNU/Hurd: (all OK) Terminal 1 and Terminal 2: ./test-flock foo r x ./test-flock foo w x ./test-flock foo r xn ./test-flock foo w xn Without both statements below the tests would not work for all cases above, at least according to my understanding. Note that these statements are made only for the *_S_file_lock.c files, i.e. the flock case. if ((openstat & O_RDONLY) && !(openstat & O_WRONLY)) openstat |= O_WRONLY; if (!(openstat & O_RDONLY) && (openstat & O_WRONLY)) openstat |= O_RDONLY; I will add comments in the code when we agree of the above issue and re-submit the libdiskfs and libnetfs patches. I've found some locking error in the libtrivfs implementation. BBL on that. (and will supply updated patches for libtrivfs and libfshelp-tests)