1 ext4: fix uniniatilized extent splitting error
3 From: Dmitry Monakhov <dmonakhov@openvz.org>
5 Fix bug reported by Dmitry Monakhov caused by lost error code
10 fd = open(argv[1], O_RDWR|O_CREAT, 0700);
11 unsigned long long sz = 0x10000000UL;
12 /* allocating big blocks chunk */
13 syscall(__NR_fallocate, fd, 0, 0UL, sz)
15 /* grab all other available filesystem space */
16 tfd = open("tmp", O_RDWR|O_CREAT|O_DIRECT, 0700);
17 while( write(tfd, buf, 4096) > 0); /* loop untill ENOSPC */
18 fsync(fd); /* just in case */
20 /* each seek+ write operation result in splits uninitialized extent
21 in three extents. Splitting may result in new extent allocation
22 which probably will fail because of ENOSPC*/
24 lseek(fd, blksize*2 -1, SEEK_CUR);
25 if ((ret = write(fd, 'a', 1)) != 1)
30 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
31 Signed-off-by: Mingming Cao <cmm@us.ibm.com>
32 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
36 fs/ext4/extents.c | 5 +++--
37 1 file changed, 3 insertions(+), 2 deletions(-)
40 Index: linux-2.6.24-rc7/fs/ext4/extents.c
41 ===================================================================
42 --- linux-2.6.24-rc7.orig/fs/ext4/extents.c 2008-01-16 13:52:19.000000000 -0800
43 +++ linux-2.6.24-rc7/fs/ext4/extents.c 2008-01-16 13:52:34.000000000 -0800
44 @@ -2373,9 +2373,10 @@ int ext4_ext_get_blocks(handle_t *handle
45 ret = ext4_ext_convert_to_initialized(handle, inode,