diff options
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
| -rw-r--r-- | net/sunrpc/rpc_pipe.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 95ccbcf45d3e..1e97d8610291 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
| @@ -27,7 +27,6 @@ | |||
| 27 | #include <linux/workqueue.h> | 27 | #include <linux/workqueue.h> |
| 28 | #include <linux/sunrpc/rpc_pipe_fs.h> | 28 | #include <linux/sunrpc/rpc_pipe_fs.h> |
| 29 | #include <linux/sunrpc/cache.h> | 29 | #include <linux/sunrpc/cache.h> |
| 30 | #include <linux/smp_lock.h> | ||
| 31 | 30 | ||
| 32 | static struct vfsmount *rpc_mount __read_mostly; | 31 | static struct vfsmount *rpc_mount __read_mostly; |
| 33 | static int rpc_mount_count; | 32 | static int rpc_mount_count; |
| @@ -309,40 +308,33 @@ rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait) | |||
| 309 | return mask; | 308 | return mask; |
| 310 | } | 309 | } |
| 311 | 310 | ||
| 312 | static int | 311 | static long |
| 313 | rpc_pipe_ioctl_unlocked(struct file *filp, unsigned int cmd, unsigned long arg) | 312 | rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
| 314 | { | 313 | { |
| 315 | struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode); | 314 | struct inode *inode = filp->f_path.dentry->d_inode; |
| 315 | struct rpc_inode *rpci = RPC_I(inode); | ||
| 316 | int len; | 316 | int len; |
| 317 | 317 | ||
| 318 | switch (cmd) { | 318 | switch (cmd) { |
| 319 | case FIONREAD: | 319 | case FIONREAD: |
| 320 | if (rpci->ops == NULL) | 320 | spin_lock(&inode->i_lock); |
| 321 | if (rpci->ops == NULL) { | ||
| 322 | spin_unlock(&inode->i_lock); | ||
| 321 | return -EPIPE; | 323 | return -EPIPE; |
| 324 | } | ||
| 322 | len = rpci->pipelen; | 325 | len = rpci->pipelen; |
| 323 | if (filp->private_data) { | 326 | if (filp->private_data) { |
| 324 | struct rpc_pipe_msg *msg; | 327 | struct rpc_pipe_msg *msg; |
| 325 | msg = (struct rpc_pipe_msg *)filp->private_data; | 328 | msg = (struct rpc_pipe_msg *)filp->private_data; |
| 326 | len += msg->len - msg->copied; | 329 | len += msg->len - msg->copied; |
| 327 | } | 330 | } |
| 331 | spin_unlock(&inode->i_lock); | ||
| 328 | return put_user(len, (int __user *)arg); | 332 | return put_user(len, (int __user *)arg); |
| 329 | default: | 333 | default: |
| 330 | return -EINVAL; | 334 | return -EINVAL; |
| 331 | } | 335 | } |
| 332 | } | 336 | } |
| 333 | 337 | ||
| 334 | static long | ||
| 335 | rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | ||
| 336 | { | ||
| 337 | long ret; | ||
| 338 | |||
| 339 | lock_kernel(); | ||
| 340 | ret = rpc_pipe_ioctl_unlocked(filp, cmd, arg); | ||
| 341 | unlock_kernel(); | ||
| 342 | |||
| 343 | return ret; | ||
| 344 | } | ||
| 345 | |||
| 346 | static const struct file_operations rpc_pipe_fops = { | 338 | static const struct file_operations rpc_pipe_fops = { |
| 347 | .owner = THIS_MODULE, | 339 | .owner = THIS_MODULE, |
| 348 | .llseek = no_llseek, | 340 | .llseek = no_llseek, |
