]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.12/ext4-fix-async-i-o-writes-beyond-4gb-to-a-sparse-file.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.12 / ext4-fix-async-i-o-writes-beyond-4gb-to-a-sparse-file.patch
1 From a1de02dccf906faba2ee2d99cac56799bda3b96a Mon Sep 17 00:00:00 2001
2 From: Eric Sandeen <sandeen@redhat.com>
3 Date: Thu, 4 Feb 2010 23:58:38 -0500
4 Subject: ext4: fix async i/o writes beyond 4GB to a sparse file
5
6 From: Eric Sandeen <sandeen@redhat.com>
7
8 commit a1de02dccf906faba2ee2d99cac56799bda3b96a upstream.
9
10 The "offset" member in ext4_io_end holds bytes, not blocks, so
11 ext4_lblk_t is wrong - and too small (u32).
12
13 This caused the async i/o writes to sparse files beyond 4GB to fail
14 when they wrapped around to 0.
15
16 Also fix up the type of arguments to ext4_convert_unwritten_extents(),
17 it gets ssize_t from ext4_end_aio_dio_nolock() and
18 ext4_ext_direct_IO().
19
20 Reported-by: Giel de Nijs <giel@vectorwise.com>
21 Signed-off-by: Eric Sandeen <sandeen@redhat.com>
22 Cc: maximilian attems <max@stro.at>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
24
25 ---
26 fs/ext4/ext4.h | 6 +++---
27 fs/ext4/extents.c | 2 +-
28 fs/ext4/inode.c | 2 +-
29 3 files changed, 5 insertions(+), 5 deletions(-)
30
31 --- a/fs/ext4/ext4.h
32 +++ b/fs/ext4/ext4.h
33 @@ -139,8 +139,8 @@ typedef struct ext4_io_end {
34 struct inode *inode; /* file being written to */
35 unsigned int flag; /* unwritten or not */
36 int error; /* I/O error code */
37 - ext4_lblk_t offset; /* offset in the file */
38 - size_t size; /* size of the extent */
39 + loff_t offset; /* offset in the file */
40 + ssize_t size; /* size of the extent */
41 struct work_struct work; /* data work queue */
42 } ext4_io_end_t;
43
44 @@ -1740,7 +1740,7 @@ extern void ext4_ext_release(struct supe
45 extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset,
46 loff_t len);
47 extern int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset,
48 - loff_t len);
49 + ssize_t len);
50 extern int ext4_get_blocks(handle_t *handle, struct inode *inode,
51 sector_t block, unsigned int max_blocks,
52 struct buffer_head *bh, int flags);
53 --- a/fs/ext4/extents.c
54 +++ b/fs/ext4/extents.c
55 @@ -3547,7 +3547,7 @@ retry:
56 * Returns 0 on success.
57 */
58 int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset,
59 - loff_t len)
60 + ssize_t len)
61 {
62 handle_t *handle;
63 ext4_lblk_t block;
64 --- a/fs/ext4/inode.c
65 +++ b/fs/ext4/inode.c
66 @@ -3547,7 +3547,7 @@ static int ext4_end_aio_dio_nolock(ext4_
67 {
68 struct inode *inode = io->inode;
69 loff_t offset = io->offset;
70 - size_t size = io->size;
71 + ssize_t size = io->size;
72 int ret = 0;
73
74 ext4_debug("end_aio_dio_onlock: io 0x%p from inode %lu,list->next 0x%p,"