[OpenAFS-devel] flock Input/output error
Simon Wilkinson
sxw@inf.ed.ac.uk
Wed, 11 Aug 2010 17:21:24 +0100
On 11 Aug 2010, at 16:14, Hans-Werner Paulsen wrote:
> time 961.188544, pid 5152: Analyze RPC op 13 conn 0xffffffffc53572c0 =
code 0x0 user 0x41629d76=20
This is a SetLock
> time 961.188660, pid 5152: Analyze RPC op 15 conn 0xffffffffc53572c0 =
code 0x0 user 0x41629d76=20
This is a ReleaseLock
That sequence of actions means that it's afs_posix_lock_file() that is =
failing - that's just a compatibility wrapper around Linux's =
posix_lock_file function, which we use to enrol our looks in the kernel =
lock management scheme. However, when posix_lock_file fails it returns a =
kernel form (negative) error code - not a positive AFS error code, and =
so afs_convert_code mangles it.
The fix for the first part is (apologies for any patch fuzz):
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
index 4beed54..a280d0e 100644
--- a/src/afs/LINUX/osi_vnodeops.c
+++ b/src/afs/LINUX/osi_vnodeops.c
@@ -480,7 +480,7 @@ afs_linux_lock(struct file *fp, int cmd, struct =
file_lock *f
#endif /* F_GETLK64 && F_GETLK !=3D F_GETLK64 */
=20
AFS_GLOCK();
- code =3D afs_lockctl(vcp, &flock, cmd, credp);
+ code =3D afs_convert_code(afs_lockctl(vcp, &flock, cmd, credp));
AFS_GUNLOCK();
=20
if ((code =3D=3D 0 || flp->fl_type =3D=3D F_UNLCK) &&=20
@@ -517,7 +517,7 @@ afs_linux_lock(struct file *fp, int cmd, struct =
file_lock *f
flp->fl_end =3D flock.l_start + flock.l_len - 1;
=20
crfree(credp);
- return afs_convert_code(code);
+ return code;
}
=20
#ifdef STRUCT_FILE_OPERATIONS_HAS_FLOCK
Once you've applied this, I would be interested to know what error your =
test now returns ...
Cheers,
Simon.