diff -u --recursive --new-file linux-2.4.7-rpc_smpfixes/fs/lockd/clntproc.c linux-2.4.7-locks/fs/lockd/clntproc.c --- linux-2.4.7-rpc_smpfixes/fs/lockd/clntproc.c Mon Dec 4 03:01:01 2000 +++ linux-2.4.7-locks/fs/lockd/clntproc.c Fri Jul 6 11:59:48 2001 @@ -142,7 +142,8 @@ /* If we're cleaning up locks because the process is exiting, * perform the RPC call asynchronously. */ - if ((cmd == F_SETLK || cmd == F_SETLKW) + if ((cmd == F_SETLK || cmd == F_SETLKW + || cmd == F_SETLK64 || cmd == F_SETLKW64) && fl->fl_type == F_UNLCK && (current->flags & PF_EXITING)) { sigfillset(¤t->blocked); /* Mask all signals */ @@ -166,13 +167,15 @@ /* Set up the argument struct */ nlmclnt_setlockargs(call, fl); - if (cmd == F_GETLK) { + if (cmd == F_GETLK || cmd == F_GETLK64) { status = nlmclnt_test(call, fl); - } else if ((cmd == F_SETLK || cmd == F_SETLKW) + } else if ((cmd == F_SETLK || cmd == F_SETLKW + || cmd == F_SETLK64 || cmd == F_SETLKW64) && fl->fl_type == F_UNLCK) { status = nlmclnt_unlock(call, fl); - } else if (cmd == F_SETLK || cmd == F_SETLKW) { - call->a_args.block = (cmd == F_SETLKW)? 1 : 0; + } else if (cmd == F_SETLK || cmd == F_SETLKW + || cmd == F_SETLK64 || cmd == F_SETLKW64) { + call->a_args.block = (cmd == F_SETLKW) || cmd == F_SETLKW64? 1 : 0; status = nlmclnt_lock(call, fl); } else { status = -EINVAL; diff -u --recursive --new-file linux-2.4.7-rpc_smpfixes/fs/locks.c linux-2.4.7-locks/fs/locks.c --- linux-2.4.7-rpc_smpfixes/fs/locks.c Fri Jul 6 11:51:29 2001 +++ linux-2.4.7-locks/fs/locks.c Fri Jul 6 11:59:48 2001 @@ -257,7 +257,7 @@ static int flock_to_posix_lock(struct file *filp, struct file_lock *fl, struct flock *l) { - loff_t start; + off_t start, end; switch (l->l_whence) { case 0: /*SEEK_SET*/ @@ -270,17 +270,16 @@ start = filp->f_dentry->d_inode->i_size; break; default: - return (0); + return -EINVAL; } if (((start += l->l_start) < 0) || (l->l_len < 0)) - return (0); - fl->fl_end = start + l->l_len - 1; - if (l->l_len > 0 && fl->fl_end < 0) - return (0); - if (fl->fl_end > OFFT_OFFSET_MAX) - return 0; + return -EINVAL; + end = start + l->l_len - 1; + if (l->l_len > 0 && end < 0) + return -EOVERFLOW; fl->fl_start = start; /* we record the absolute position */ + fl->fl_end = end; if (l->l_len == 0) fl->fl_end = OFFSET_MAX; @@ -292,7 +291,7 @@ fl->fl_insert = NULL; fl->fl_remove = NULL; - return (assign_type(fl, l->l_type) == 0); + return assign_type(fl, l->l_type); } #if BITS_PER_LONG == 32 @@ -312,14 +311,14 @@ start = filp->f_dentry->d_inode->i_size; break; default: - return (0); + return -EINVAL; } if (((start += l->l_start) < 0) || (l->l_len < 0)) - return (0); + return -EINVAL; fl->fl_end = start + l->l_len - 1; if (l->l_len > 0 && fl->fl_end < 0) - return (0); + return -EOVERFLOW; fl->fl_start = start; /* we record the absolute position */ if (l->l_len == 0) fl->fl_end = OFFSET_MAX; @@ -339,10 +338,10 @@ fl->fl_type = l->l_type; break; default: - return (0); + return -EINVAL; } - return (1); + return (0); } #endif @@ -1353,8 +1352,8 @@ if (!filp) goto out; - error = -EINVAL; - if (!flock_to_posix_lock(filp, &file_lock, &flock)) + error = flock_to_posix_lock(filp, &file_lock, &flock); + if (error) goto out_putf; if (filp->f_op && filp->f_op->lock) { @@ -1443,8 +1442,8 @@ } } - error = -EINVAL; - if (!flock_to_posix_lock(filp, file_lock, &flock)) + error = flock_to_posix_lock(filp, file_lock, &flock); + if (error) goto out_putf; error = -EBADF; @@ -1518,8 +1517,8 @@ if (!filp) goto out; - error = -EINVAL; - if (!flock64_to_posix_lock(filp, &file_lock, &flock)) + error = flock64_to_posix_lock(filp, &file_lock, &flock); + if (error) goto out_putf; if (filp->f_op && filp->f_op->lock) { @@ -1596,8 +1595,8 @@ } } - error = -EINVAL; - if (!flock64_to_posix_lock(filp, file_lock, &flock)) + error = flock64_to_posix_lock(filp, file_lock, &flock); + if (error) goto out_putf; error = -EBADF; diff -u --recursive --new-file linux-2.4.7-rpc_smpfixes/fs/nfs/file.c linux-2.4.7-locks/fs/nfs/file.c --- linux-2.4.7-rpc_smpfixes/fs/nfs/file.c Fri Jul 6 11:57:30 2001 +++ linux-2.4.7-locks/fs/nfs/file.c Fri Jul 6 12:01:36 2001 @@ -273,7 +273,7 @@ /* Fake OK code if mounted without NLM support */ if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM) { - if (cmd == F_GETLK) + if (cmd == F_GETLK || cmd == F_GETLK64) status = LOCK_USE_CLNT; goto out_ok; } @@ -313,13 +313,20 @@ * This makes locking act as a cache coherency point. */ out_ok: - if ((cmd == F_SETLK || cmd == F_SETLKW) && fl->fl_type != F_UNLCK) { - filemap_fdatasync(inode->i_mapping); - down(&inode->i_sem); - nfs_wb_all(inode); /* we may have slept */ - up(&inode->i_sem); - filemap_fdatawait(inode->i_mapping); - nfs_zap_caches(inode); + switch (cmd) { + case F_SETLK: + case F_SETLKW: + case F_SETLK64: + case F_SETLKW64: + if (fl->fl_type != F_UNLCK) { + filemap_fdatasync(inode->i_mapping); + down(&inode->i_sem); + nfs_wb_all(inode); /* we may have slept */ + up(&inode->i_sem); + filemap_fdatawait(inode->i_mapping); + nfs_zap_caches(inode); + } + default: } return status; }