ext4: Fix insertion point of extent in mext_insert_across_blocks()
authorAkira Fujita <a-fujita@rs.jp.nec.com>
Thu, 4 Mar 2010 05:31:06 +0000 (00:31 -0500)
committerMatt Sealey <matt@genesi-usa.com>
Mon, 29 Nov 2010 23:07:59 +0000 (17:07 -0600)
commitd016695d8e6d654b7d0129d09748f9695cd757e4
tree58e1b92e16a647b11618d40447902c9ef2e0c0d4
parentf97ecea19c92dda234433ad30c5dadc913950544
ext4: Fix insertion point of extent in mext_insert_across_blocks()

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>
fs/ext4/move_extent.c