[OpenAFS] Using a file lock to avoid race conditions?

Jeffrey Altman jaltman@secure-endpoints.com
Tue, 15 Mar 2011 12:46:06 -0400

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 3/15/2011 12:14 PM, Edgecombe, Jason wrote:

> I=E2=80=99m thinking of using a file lock (i.e. flock) in AFS to determ=
ine who
> fetches the email, but I need to know about the failure scenarios. Does=

> the lock persist if the machine freezes or dies? Will an orphaned lock
> expire, and if so, how long does it take to expire?

Locks in AFS are issued with a five minute lifetime and must be renewed
by a client.

Write-locks are exclusive to a single client.  If the client dies or
otherwise becomes disconnected from the file server that issued the
lock, the lock will expire 5 minutes after it was issued.

Read-locks are shared and can be issued to multiple clients.  A
read-lock is renewed whenever any client requests a renewal.  If a
client fails or becomes disconnected from the file server, its lock
count will persist until five minutes after the last renewal request is

Obviously, the existence of an outstanding read-lock prevents the
granting of a write-lock.

Jeffrey Altman

Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

Version: GnuPG v1.4.9 (MingW32)