[AIO] fix io_wait When an application is mixing sync and async IO it ends up crashing later on in the sync path when calling lock_page_slow as the io_wait queue has been set to NULL in a previous AIO request. Therefore after the retry method has been called the task io_wait queue should be reset to the default queue. This patch applies over Suparna's wait-bit patchset: - modify-wait-bit-action-args - lock_page_wait - init-wait-bit-key - tsk-default-io-wait - aio-wait-bit - aio-wait-page and could be folded into aio-wait-bit. Signed-off-by: Sébastien Dugué Signed-off-by: Benjamin LaHaise diff -purN --exclude=description 79_fix-io_wait/net/socket.c 80_no_net_aio/net/socket.c --- 79_fix-io_wait/net/socket.c 2005-08-04 15:56:11.000000000 -0400 +++ 80_no_net_aio/net/socket.c 2005-08-09 17:06:46.000000000 -0400 @@ -108,6 +108,10 @@ static unsigned int sock_poll(struct fil static long sock_ioctl(struct file *file, unsigned int cmd, unsigned long arg); static int sock_fasync(int fd, struct file *filp, int on); +static ssize_t sock_read(struct file *file, char __user *buf, + size_t len, loff_t *ppos); +static ssize_t sock_write(struct file *file, const char __user *buf, + size_t len, loff_t *ppos); static ssize_t sock_readv(struct file *file, const struct iovec *vector, unsigned long count, loff_t *ppos); static ssize_t sock_writev(struct file *file, const struct iovec *vector, @@ -124,8 +128,12 @@ static ssize_t sock_sendpage(struct file static struct file_operations socket_file_ops = { .owner = THIS_MODULE, .llseek = no_llseek, +#if 0 .aio_read = sock_aio_read, .aio_write = sock_aio_write, +#endif + .read = sock_read, + .write = sock_write, .poll = sock_poll, .unlocked_ioctl = sock_ioctl, .mmap = sock_mmap, @@ -638,7 +646,6 @@ static void sock_aio_dtor(struct kiocb * * Read data from a socket. ubuf is a user mode pointer. We make sure the user * area ubuf...ubuf+size-1 is writable before asking the protocol. */ - static ssize_t sock_aio_read(struct kiocb *iocb, char __user *ubuf, size_t size, loff_t pos) { @@ -772,7 +779,13 @@ static ssize_t sock_readv(struct file *f return sock_readv_writev(VERIFY_WRITE, file->f_dentry->d_inode, file, vector, count, tot_len); } - + +static ssize_t sock_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) +{ + struct iovec local_iov = { .iov_base = buf, .iov_len = len }; + return sock_readv(file, &local_iov, len, ppos); +} + static ssize_t sock_writev(struct file *file, const struct iovec *vector, unsigned long count, loff_t *ppos) { @@ -784,6 +797,13 @@ static ssize_t sock_writev(struct file * file, vector, count, tot_len); } +static ssize_t sock_write(struct file *file, const char __user *buf, size_t len, loff_t *ppos) +{ + struct iovec local_iov = { .iov_base = (void __user *)buf, + .iov_len = len }; + return sock_writev(file, &local_iov, len, ppos); +} + /* * Atomic setting of ioctl hooks to avoid race