Strange leases behaviour

From: Adam Osuchowski
Date: Sun Jan 18 2009 - 19:47:00 EST


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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/