Commit 1f260946 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs fixes from Al Viro:
 "This contains a couple of fixes - one is the aio fix from Christoph,
  the other a fallocate() one from Eric"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  vfs: fix check for fallocate on active swapfile
  direct-io: fix AIO regression
parents f88cf230 6d2b6170
...@@ -71,7 +71,6 @@ struct dio_submit { ...@@ -71,7 +71,6 @@ struct dio_submit {
been performed at the start of a been performed at the start of a
write */ write */
int pages_in_io; /* approximate total IO pages */ int pages_in_io; /* approximate total IO pages */
size_t size; /* total request size (doesn't change)*/
sector_t block_in_file; /* Current offset into the underlying sector_t block_in_file; /* Current offset into the underlying
file in dio_block units. */ file in dio_block units. */
unsigned blocks_available; /* At block_in_file. changes */ unsigned blocks_available; /* At block_in_file. changes */
...@@ -1104,7 +1103,8 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, ...@@ -1104,7 +1103,8 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
unsigned blkbits = i_blkbits; unsigned blkbits = i_blkbits;
unsigned blocksize_mask = (1 << blkbits) - 1; unsigned blocksize_mask = (1 << blkbits) - 1;
ssize_t retval = -EINVAL; ssize_t retval = -EINVAL;
loff_t end = offset + iov_iter_count(iter); size_t count = iov_iter_count(iter);
loff_t end = offset + count;
struct dio *dio; struct dio *dio;
struct dio_submit sdio = { 0, }; struct dio_submit sdio = { 0, };
struct buffer_head map_bh = { 0, }; struct buffer_head map_bh = { 0, };
...@@ -1287,10 +1287,9 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, ...@@ -1287,10 +1287,9 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
*/ */
BUG_ON(retval == -EIOCBQUEUED); BUG_ON(retval == -EIOCBQUEUED);
if (dio->is_async && retval == 0 && dio->result && if (dio->is_async && retval == 0 && dio->result &&
((rw == READ) || (dio->result == sdio.size))) (rw == READ || dio->result == count))
retval = -EIOCBQUEUED; retval = -EIOCBQUEUED;
else
if (retval != -EIOCBQUEUED)
dio_await_completion(dio); dio_await_completion(dio);
if (drop_refcount(dio) == 0) { if (drop_refcount(dio) == 0) {
......
...@@ -263,11 +263,10 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) ...@@ -263,11 +263,10 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
return -EPERM; return -EPERM;
/* /*
* We can not allow to do any fallocate operation on an active * We cannot allow any fallocate operation on an active swapfile
* swapfile
*/ */
if (IS_SWAPFILE(inode)) if (IS_SWAPFILE(inode))
ret = -ETXTBSY; return -ETXTBSY;
/* /*
* Revalidate the write permissions, in case security policy has * Revalidate the write permissions, in case security policy has
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment