aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/proc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-16 17:49:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-16 17:49:49 -0400
commit8df1b049bc86495a40e421abc8b9cf1dda32f0d9 (patch)
treeed0d7f582b401852a9ea98f572076131950a15c4 /fs/nfs/proc.c
parenta3cf859321486f69506326146ab3e2fd15c05c3f (diff)
parentcadc723cc19ce6b881d973d3c04e25ebb83058e6 (diff)
Merge git://git.linux-nfs.org/projects/trondmy/nfs-2.6
* git://git.linux-nfs.org/projects/trondmy/nfs-2.6: (82 commits) NFSv4: Remove BKL from the nfsv4 state recovery SUNRPC: Remove the BKL from the callback functions NFS: Remove BKL from the readdir code NFS: Remove BKL from the symlink code NFS: Remove BKL from the sillydelete operations NFS: Remove the BKL from the rename, rmdir and unlink operations NFS: Remove BKL from NFS lookup code NFS: Remove the BKL from nfs_link() NFS: Remove the BKL from the inode creation operations NFS: Remove BKL usage from open() NFS: Remove BKL usage from the write path NFS: Remove the BKL from the permission checking code NFS: Remove attribute update related BKL references NFS: Remove BKL requirement from attribute updates NFS: Protect inode->i_nlink updates using inode->i_lock nfs: set correct fl_len in nlmclnt_test() SUNRPC: Support registering IPv6 interfaces with local rpcbind daemon SUNRPC: Refactor rpcb_register to make rpcbindv4 support easier SUNRPC: None of rpcb_create's callers wants a privileged source port SUNRPC: Introduce a specific rpcb_create for contacting localhost ...
Diffstat (limited to 'fs/nfs/proc.c')
-rw-r--r--fs/nfs/proc.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index 03599bfe81cf..4dbb84df1b68 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -129,6 +129,8 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
129 sattr->ia_mode &= S_IALLUGO; 129 sattr->ia_mode &= S_IALLUGO;
130 130
131 dprintk("NFS call setattr\n"); 131 dprintk("NFS call setattr\n");
132 if (sattr->ia_valid & ATTR_FILE)
133 msg.rpc_cred = nfs_file_cred(sattr->ia_file);
132 nfs_fattr_init(fattr); 134 nfs_fattr_init(fattr);
133 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); 135 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
134 if (status == 0) 136 if (status == 0)
@@ -598,6 +600,29 @@ nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
598 return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl); 600 return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl);
599} 601}
600 602
603/* Helper functions for NFS lock bounds checking */
604#define NFS_LOCK32_OFFSET_MAX ((__s32)0x7fffffffUL)
605static int nfs_lock_check_bounds(const struct file_lock *fl)
606{
607 __s32 start, end;
608
609 start = (__s32)fl->fl_start;
610 if ((loff_t)start != fl->fl_start)
611 goto out_einval;
612
613 if (fl->fl_end != OFFSET_MAX) {
614 end = (__s32)fl->fl_end;
615 if ((loff_t)end != fl->fl_end)
616 goto out_einval;
617 } else
618 end = NFS_LOCK32_OFFSET_MAX;
619
620 if (start < 0 || start > end)
621 goto out_einval;
622 return 0;
623out_einval:
624 return -EINVAL;
625}
601 626
602const struct nfs_rpc_ops nfs_v2_clientops = { 627const struct nfs_rpc_ops nfs_v2_clientops = {
603 .version = 2, /* protocol version */ 628 .version = 2, /* protocol version */
@@ -630,7 +655,6 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
630 .write_setup = nfs_proc_write_setup, 655 .write_setup = nfs_proc_write_setup,
631 .write_done = nfs_write_done, 656 .write_done = nfs_write_done,
632 .commit_setup = nfs_proc_commit_setup, 657 .commit_setup = nfs_proc_commit_setup,
633 .file_open = nfs_open,
634 .file_release = nfs_release,
635 .lock = nfs_proc_lock, 658 .lock = nfs_proc_lock,
659 .lock_check_bounds = nfs_lock_check_bounds,
636}; 660};