[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)
--------------enigFDB468F4CA878037A1630F60
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
issued.

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

Jeffrey Altman


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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)

iQEcBAEBAgAGBQJNf5fQAAoJENxm1CNJffh4OCUIAM+euIxCDOkj2imLJ4iWvyrS
89xeBWndj63xMd2vEDD4OjHH5vWY5Nme76dsVbt+FjGBwiwXTCKizMke3NHMTCfg
O3ib/IHQC4Sv45cYwQyOisvlGxhdyxIJEGp5It7+qEavZesUuw8m98MljwMBRmxE
WyxRGEmgsDmTUZB17QfEMG+e+24DsIOgwN767vQADC06gJOUEj4i5Ci2G1Lj1TrD
tFUUplnnk0894wcPvw1pf7hUR/Fi2sXTQyt2QCP8S3otAvF9VwwchSR47Knsy1v9
3iM4XSDG+MUbZPhyRjFSVN0Zkgg7+/QWTHHZaigA69RQmy5VZ7/S44mJcuyFMgA=
=d7wu
-----END PGP SIGNATURE-----

--------------enigFDB468F4CA878037A1630F60--