Skip to content

Commit 1f26094

Browse files
committed
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
2 parents f88cf23 + 6d2b617 commit 1f26094

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

fs/direct-io.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ struct dio_submit {
7171
been performed at the start of a
7272
write */
7373
int pages_in_io; /* approximate total IO pages */
74-
size_t size; /* total request size (doesn't change)*/
7574
sector_t block_in_file; /* Current offset into the underlying
7675
file in dio_block units. */
7776
unsigned blocks_available; /* At block_in_file. changes */
@@ -1104,7 +1103,8 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
11041103
unsigned blkbits = i_blkbits;
11051104
unsigned blocksize_mask = (1 << blkbits) - 1;
11061105
ssize_t retval = -EINVAL;
1107-
loff_t end = offset + iov_iter_count(iter);
1106+
size_t count = iov_iter_count(iter);
1107+
loff_t end = offset + count;
11081108
struct dio *dio;
11091109
struct dio_submit sdio = { 0, };
11101110
struct buffer_head map_bh = { 0, };
@@ -1287,10 +1287,9 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
12871287
*/
12881288
BUG_ON(retval == -EIOCBQUEUED);
12891289
if (dio->is_async && retval == 0 && dio->result &&
1290-
((rw == READ) || (dio->result == sdio.size)))
1290+
(rw == READ || dio->result == count))
12911291
retval = -EIOCBQUEUED;
1292-
1293-
if (retval != -EIOCBQUEUED)
1292+
else
12941293
dio_await_completion(dio);
12951294

12961295
if (drop_refcount(dio) == 0) {

fs/open.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,10 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
263263
return -EPERM;
264264

265265
/*
266-
* We can not allow to do any fallocate operation on an active
267-
* swapfile
266+
* We cannot allow any fallocate operation on an active swapfile
268267
*/
269268
if (IS_SWAPFILE(inode))
270-
ret = -ETXTBSY;
269+
return -ETXTBSY;
271270

272271
/*
273272
* Revalidate the write permissions, in case security policy has

0 commit comments

Comments
 (0)