Skip to contentSkip to conversation

Strange leases behaviour

DISCUSSION Adam Osuchowski 1 participant 1 message Jan 19, 2009

lore
Share & tools
lore
#0 lore raw

Kernel 2.6.28 and such a situation:

- process A obtains read lease on file via fcntl(fd, F_SETLEASE, F_RDLCK).
- while process A holds lease, process B tries to open this file for writing, what, of course, leads to block process B on open().
- while process A holds lease and process B waits on open(), process C tries to open the same file for reading.

Then, process C also blocks on open(), even though it calls open() only for reading. Even if process B terminates before process A removes lease, process C still can't open file for reading. But if process B doesn't try to open file for writing, process C can open it for reading without any trobule.

Why there is such a bahaviour? Is it not a bug?

Regards.