[OpenAFS] Re: another approach for detecting byte-range-lock safeness

Adam Megacz megacz@cs.berkeley.edu
Mon, 25 Dec 2006 17:13:31 -0800

"chas williams - CONTRACTOR" <chas@cmf.nrl.navy.mil> writes:
> In message <x3k60f1opb.fsf@nowhere.com>,Adam Megacz writes:
>>If so, perhaps I can check what OS is running, use some hardwired
>>syscall value if OS==Linux, and use the fork()-and-fcntl(F_SETLK) to
>>look for (local) enforcement of byte-range locks if OS!=Linux.

> why the special tests for linux?

Because the test doesn't work on Linux.  Asking for a byte range lock
on a 1.4.x Linux client results in the whole file being locked at the
server and correct byte-range semantics between processes *on the same

This is extra painful because (unlike the "liar locks" on other
clients) there doesn't appear to be any way to test for this behavior
without using AFS-specific APIs.  On the upside, the consequences of a
false positive under linux-openafs semantics are simply
deadlock/starvation rather than data corruption.

To avoid deadlock/starvation I need a way to detect that byte-range
locks are being upgraded and put the user program into a
(much less efficient) mode that uses only whole-file locks.

  - a

PGP/GPG: 5C9F F366 C9CF 2145 E770  B1B8 EFB1 462D A146 C380