X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=net%2Fsunrpc%2Frpc_pipe.c;h=28bcd52e3ce97428c296989cdb637d71f31a6693;hb=5704e44d283e907623e3775c1262f206a2c48cf3;hp=8c8eef2b8f26a205bef37706b900c6936a492ed8;hpb=4a73a43741489a652588460e72be959e60bcb9ec;p=pandora-kernel.git diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 8c8eef2b8f26..28bcd52e3ce9 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -27,7 +27,6 @@ #include #include #include -#include static struct vfsmount *rpc_mount __read_mostly; static int rpc_mount_count; @@ -309,40 +308,33 @@ rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait) return mask; } -static int -rpc_pipe_ioctl_unlocked(struct file *filp, unsigned int cmd, unsigned long arg) +static long +rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode); + struct inode *inode = filp->f_path.dentry->d_inode; + struct rpc_inode *rpci = RPC_I(inode); int len; switch (cmd) { case FIONREAD: - if (rpci->ops == NULL) + spin_lock(&inode->i_lock); + if (rpci->ops == NULL) { + spin_unlock(&inode->i_lock); return -EPIPE; + } len = rpci->pipelen; if (filp->private_data) { struct rpc_pipe_msg *msg; msg = (struct rpc_pipe_msg *)filp->private_data; len += msg->len - msg->copied; } + spin_unlock(&inode->i_lock); return put_user(len, (int __user *)arg); default: return -EINVAL; } } -static long -rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) -{ - long ret; - - lock_kernel(); - ret = rpc_pipe_ioctl_unlocked(filp, cmd, arg); - unlock_kernel(); - - return ret; -} - static const struct file_operations rpc_pipe_fops = { .owner = THIS_MODULE, .llseek = no_llseek,