LINUX: More flock fixes

Turns out the we have two almost identical lock routines on Linux,
one for POSIX locks, and one for flocks. Fix them both. Also,
while we're at it, make the same fixes in the LINUX24 tree.

Thanks to Andrew Deason for pointing out the oversight in the
original patch (5abe706a7e237d3872db3638d947a14c935370d5)

Change-Id: I59f0f1e12af36a97e490df36537ac17e8ed87303
Reviewed-on: http://gerrit.openafs.org/2535
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
Simon Wilkinson 2010-08-11 23:14:31 +01:00 committed by Jeffrey Altman
parent 5a2ae98327
commit f7d298d367
2 changed files with 6 additions and 6 deletions

View File

@ -546,7 +546,7 @@ afs_linux_flock(struct file *fp, int cmd, struct file_lock *flp) {
#endif /* F_GETLK64 && F_GETLK != F_GETLK64 */ #endif /* F_GETLK64 && F_GETLK != F_GETLK64 */
AFS_GLOCK(); AFS_GLOCK();
code = afs_lockctl(vcp, &flock, cmd, credp); code = afs_convert_code(afs_lockctl(vcp, &flock, cmd, credp));
AFS_GUNLOCK(); AFS_GUNLOCK();
if ((code == 0 || flp->fl_type == F_UNLCK) && if ((code == 0 || flp->fl_type == F_UNLCK) &&
@ -567,7 +567,7 @@ afs_linux_flock(struct file *fp, int cmd, struct file_lock *flp) {
flp->fl_pid = flock.l_pid; flp->fl_pid = flock.l_pid;
crfree(credp); crfree(credp);
return afs_convert_code(code); return code;
} }
#endif #endif

View File

@ -541,7 +541,7 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp)
#endif /* F_GETLK64 && F_GETLK != F_GETLK64 */ #endif /* F_GETLK64 && F_GETLK != F_GETLK64 */
AFS_GLOCK(); AFS_GLOCK();
code = afs_lockctl(vcp, &flock, cmd, credp); code = afs_convert_code(afs_lockctl(vcp, &flock, cmd, credp));
AFS_GUNLOCK(); AFS_GUNLOCK();
#ifdef AFS_LINUX24_ENV #ifdef AFS_LINUX24_ENV
@ -601,7 +601,7 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp)
flp->fl_end = flock.l_start + flock.l_len - 1; flp->fl_end = flock.l_start + flock.l_len - 1;
crfree(credp); crfree(credp);
return afs_convert_code(code); return code;
} }
#ifdef STRUCT_FILE_OPERATIONS_HAS_FLOCK #ifdef STRUCT_FILE_OPERATIONS_HAS_FLOCK
@ -630,7 +630,7 @@ afs_linux_flock(struct file *fp, int cmd, struct file_lock *flp) {
#endif /* F_GETLK64 && F_GETLK != F_GETLK64 */ #endif /* F_GETLK64 && F_GETLK != F_GETLK64 */
AFS_GLOCK(); AFS_GLOCK();
code = afs_lockctl(vcp, &flock, cmd, credp); code = afs_convert_code(afs_lockctl(vcp, &flock, cmd, credp));
AFS_GUNLOCK(); AFS_GUNLOCK();
if ((code == 0 || flp->fl_type == F_UNLCK) && if ((code == 0 || flp->fl_type == F_UNLCK) &&
@ -651,7 +651,7 @@ afs_linux_flock(struct file *fp, int cmd, struct file_lock *flp) {
flp->fl_pid = flock.l_pid; flp->fl_pid = flock.l_pid;
crfree(credp); crfree(credp);
return afs_convert_code(code); return code;
} }
#endif #endif