diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 0819dd8566..f661ecd060 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -491,7 +491,10 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp) flock.l_pid = flp->fl_pid; flock.l_whence = 0; flock.l_start = flp->fl_start; - flock.l_len = flp->fl_end - flp->fl_start + 1; + if (flp->fl_end == OFFSET_MAX) + flock.l_len = 0; /* Lock to end of file */ + else + flock.l_len = flp->fl_end - flp->fl_start + 1; /* Safe because there are no large files, yet */ #if defined(F_GETLK64) && (F_GETLK != F_GETLK64) @@ -558,7 +561,10 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp) flp->fl_type = flock.l_type; flp->fl_pid = flock.l_pid; flp->fl_start = flock.l_start; - flp->fl_end = flock.l_start + flock.l_len - 1; + if (flock.l_len == 0) + flp->fl_end = OFFSET_MAX; /* Lock to end of file */ + else + flp->fl_end = flock.l_start + flock.l_len - 1; crfree(credp); return afs_convert_code(code); @@ -577,7 +583,7 @@ afs_linux_flock(struct file *fp, int cmd, struct file_lock *flp) { flock.l_pid = flp->fl_pid; flock.l_whence = 0; flock.l_start = 0; - flock.l_len = OFFSET_MAX; + flock.l_len = 0; /* Safe because there are no large files, yet */ #if defined(F_GETLK64) && (F_GETLK != F_GETLK64)