[OpenAFS-devel] flock Input/output error

Hans-Werner Paulsen hans@MPA-Garching.MPG.DE
Wed, 18 Aug 2010 11:14:16 +0200


On Thu, Aug 12, 2010 at 02:45:59PM +0100, Simon Wilkinson wrote:
>=20
> On 12 Aug 2010, at 14:43, Hans-Werner Paulsen wrote:
> > Isn't possible to do ReleaseKernelLock first, and then ReleaseAFSLock=
 on
> > unlock?
>=20
> If ReleaseAFSLock fails for some reason, we don't want to release the k=
ernel lock. Releasing it, only to reobtain it, is racy. I'm pretty sure t=
hat the correct solution here is to hold the vcache lock across the calls=
 - I'll hopefully get a chance to look at some code to do this today.

Releasing a lock:
Holding the vcache lock does not guarantee that we can reobtain the AFS l=
ock,
if the kernel release lock fails.
Obtaining a lock:
Holding the vcache lock does not guarantee that we can release the AFS lo=
ck,
if the kernel set lock fails. (The current code is doing this.)
On the other hand local byte range locking is a hack, we need AFS byte ra=
nge
locking. Therefore we should not put too much work into the local kernel
locking code.
Releasing the kernel lock before releasing the AFS lock is a simple
modification, and is better than the current code.
I will send a patch to gerrit, soon.

HW

--=20
Hans-Werner Paulsen		hans@MPA-Garching.MPG.DE
MPI f=FCr Astrophysik		Tel 089-30000-2602
Karl-Schwarzschild-Str. 1	Fax 089-30000-2235=09
D-85741 Garching