[OpenAFS] File locking in AFS
Karthik, R
r.karthik@digital.com
Wed, 19 Sep 2001 19:25:47 +0530
Hi Craig,
>>>The way locking works is strictly advisory: possession of locks is
>>>independent of whether I/O may be done on the file.
Does this mean a file can be written to even if a client has a read-lock on
the file? Please clarify.
-Karthik
-----Original Message-----
From: Craig_Everhart@transarc.com [mailto:Craig_Everhart@transarc.com]
Sent: Wednesday, September 19, 2001 7:09 PM
To: Openafs-Info (E-mail); Karthik, R
Subject: Re: [OpenAFS] File locking in AFS
Sure, read and write locks work fine with AFS with the caveat that locks
on subranges of the file don't work. That is, if you read-lock or
write-lock the whole range of a file, that works fine, but if you
read-lock or write-lock a byte range smaller than the entire file, the
lock request is *ignored.*
The way locking works is strictly advisory: possession of locks is
independent of whether I/O may be done on the file.
On Unix@-(tm), fcntl() and/or lockf() calls may be used to set locks.
Locks are held until released by the calling client (or by a crash or
the like), so a held read-lock is not invalidated by a write-lock
request. Instead, the write-lock is denied. The strategy is that
read-locks can be shared (held concurrently by multiple applications,
potentially on many clients) while write-locks are exclusive (held by at
most one application on one client at a time). Furthermore, read-locks
and write-locks exclude one another.
Craig