add patch discard-preallocations-after-removing-space
[ext4-patch-queue.git] / use-i_size_read-in-ext4_unaligned_aio
blob72ebeb5c8ab7091e912716bf7e75a658b7b766e7
1 ext4: use i_size_read in ext4_unaligned_aio()
3 We haven't taken i_mutex yet, so we need to use i_size_read().
5 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
6 Cc: stable@vger.kernel.org
7 ---
8  fs/ext4/file.c | 2 +-
9  1 file changed, 1 insertion(+), 1 deletion(-)
11 diff --git a/fs/ext4/file.c b/fs/ext4/file.c
12 index 6db7f7d..bc76559 100644
13 --- a/fs/ext4/file.c
14 +++ b/fs/ext4/file.c
15 @@ -82,7 +82,7 @@ ext4_unaligned_aio(struct inode *inode, const struct iovec *iov,
16         size_t count = iov_length(iov, nr_segs);
17         loff_t final_size = pos + count;
19 -       if (pos >= inode->i_size)
20 +       if (pos >= i_size_read(inode))
21                 return 0;
23         if ((pos & blockmask) || (final_size & blockmask))