linux-enroll-locks-20060403

FIXES 25037

enroll our locks in the linux kernels' lock management
This commit is contained in:
Chaskiel M Grundman 2006-04-04 02:41:12 +00:00 committed by Derrick Brashear
parent ef95f2a0ce
commit 62e28d9a0a

View File

@ -463,6 +463,25 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp)
code = afs_lockctl(vcp, &flock, cmd, credp);
AFS_GUNLOCK();
#ifdef AFS_LINUX24_ENV
if (code == 0 && (cmd == F_SETLK || cmd == F_SETLKW)) {
struct file_lock flp2;
flp2 = *flp;
#ifdef AFS_LINUX26_ENV
flp2.fl_flags &=~ FL_SLEEP;
#endif
code = posix_lock_file(fp, &flp2);
osi_Assert(code != -EAGAIN); /* there should be no conflicts */
if (code) {
struct AFS_FLOCK flock2;
flock2 = flock;
flock2.l_type = F_UNLCK;
AFS_GLOCK();
afs_lockctl(vcp, &flock2, F_SETLK, credp);
AFS_GUNLOCK();
}
}
#endif
/* Convert flock back to Linux's file_lock */
flp->fl_type = flock.l_type;
flp->fl_pid = flock.l_pid;