ext4: Fix insertion point of extent in mext_insert_across_blocks()
commit68285a49fce5634e194be0de1aec6e423d74e1cc
authorAkira Fujita <a-fujita@rs.jp.nec.com>
Mon, 31 May 2010 02:49:35 +0000 (30 22:49 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 2 Aug 2010 17:21:14 +0000 (2 10:21 -0700)
tree24f7e4ec8be3b816180581800f3bfdd3956ef237
parent2b8aa5edf84a8e7cc432cbfda2be7cefa0a46347
ext4: Fix insertion point of extent in mext_insert_across_blocks()

commit 5fd5249aa36fad98c9fd5edced352939e54f9324 upstream (as of v2.6.33-git11)

If the leaf node has 2 extent space or fewer and EXT4_IOC_MOVE_EXT
ioctl is called with the file offset where after the 2nd extent
covers, mext_insert_across_blocks() always tries to insert extent into
the first extent.  As a result, the file gets corrupted because of
wrong extent order.  The patch fixes this problem.

Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ext4/move_extent.c