aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2008-01-28 23:58:27 -0500
committerTheodore Ts'o <tytso@mit.edu>2008-01-28 23:58:27 -0500
commitdbf9d7da33f79302fb1e4d7c6b2f6598e8608e72 (patch)
tree0065fa9b23765b42aed171cc3e070aabb655d9de
parentce40733ce93de402ed629762f0e912d9af187cef (diff)
ext4: fix uniniatilized extent splitting error
Fix bug reported by Dmitry Monakhov caused by lost error code Testcase: blksize = 0x1000; fd = open(argv[1], O_RDWR|O_CREAT, 0700); unsigned long long sz = 0x10000000UL; /* allocating big blocks chunk */ syscall(__NR_fallocate, fd, 0, 0UL, sz) /* grab all other available filesystem space */ tfd = open("tmp", O_RDWR|O_CREAT|O_DIRECT, 0700); while( write(tfd, buf, 4096) > 0); /* loop untill ENOSPC */ fsync(fd); /* just in case */ while (pos < sz) { /* each seek+ write operation result in splits uninitialized extent in three extents. Splitting may result in new extent allocation which probably will fail because of ENOSPC*/ lseek(fd, blksize*2 -1, SEEK_CUR); if ((ret = write(fd, 'a', 1)) != 1) exit(1); pos += blksize * 2; } Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/extents.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 0cffb59fff46..ce9aa5860569 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2373,9 +2373,10 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2373 ret = ext4_ext_convert_to_initialized(handle, inode, 2373 ret = ext4_ext_convert_to_initialized(handle, inode,
2374 path, iblock, 2374 path, iblock,
2375 max_blocks); 2375 max_blocks);
2376 if (ret <= 0) 2376 if (ret <= 0) {
2377 err = ret;
2377 goto out2; 2378 goto out2;
2378 else 2379 } else
2379 allocated = ret; 2380 allocated = ret;
2380 goto outnew; 2381 goto outnew;
2381 } 2382 }