[OpenAFS-devel] linux-and-locks-cleanup-20070202 crashes linux
kernels older than 2.6.17 (see RT #53457)
Christopher Allen Wing
wingc@engin.umich.edu
Thu, 8 Feb 2007 15:07:29 -0500 (EST)
On Thu, 8 Feb 2007, Derrick J Brashear wrote:
> On Thu, 8 Feb 2007, Marcus Watts wrote:
>
>> Christopher Allen Wing <wingc@engin.umich.edu> writes:
>> ...
>>> There does not seem to be a good way to find out (e.g., autoconf test) if
>>> a particular linux kernel has the 'old' or 'new' semantics of
>>> flock_lock_file*(). The argument types of the functions have not changed.
>> ...
>>
>> This sounds like it's a feature that is almost exactly
>> tied to linux kernel version. Testing the Linux kernel
>
> Except for people like RedHat, Fedora, SuSe, who cherrypick patches.
>
>> should suffice to determine if the new locking semantics
>> are true.
>
> Nope.
indeed.
this is what I am testing now. I believe it should be safe everywhere,
and keep the existing semantics:
--- openafs-1.4.2/src/afs/LINUX/osi_vnodeops.c.orig 2007-02-08 14:22:27.000000000 -0500
+++ openafs-1.4.2/src/afs/LINUX/osi_vnodeops.c 2007-02-08 14:28:26.000000000 -0500
@@ -475,10 +475,8 @@
if ((code == 0 || flp->fl_type == F_UNLCK) &&
(cmd == F_SETLK || cmd == F_SETLKW)) {
#ifdef AFS_LINUX26_ENV
- struct file_lock flp2;
- flp2 = *flp;
- flp2.fl_flags &=~ FL_SLEEP;
- code = posix_lock_file(fp, &flp2);
+ flp->fl_flags &=~ FL_SLEEP;
+ code = posix_lock_file(fp, flp);
#else
code = posix_lock_file(fp, flp, 0);
#endif
@@ -534,10 +532,8 @@
if ((code == 0 || flp->fl_type == F_UNLCK) &&
(cmd == F_SETLK || cmd == F_SETLKW)) {
- struct file_lock flp2;
- flp2 = *flp;
- flp2.fl_flags &=~ FL_SLEEP;
- code = flock_lock_file_wait(fp, &flp2);
+ flp->fl_flags &=~ FL_SLEEP;
+ code = flock_lock_file_wait(fp, flp);
if (code && flp->fl_type != F_UNLCK) {
struct AFS_FLOCK flock2;
flock2 = flock;