From: Jan Kara Date: Wed, 9 Dec 2009 02:24:33 +0000 (-0500) Subject: ext4: Avoid data / filesystem corruption when write fails to copy data X-Git-Tag: v2.6.33-rc1~330^2~10 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9a4207d5e911b938f73079a83cc2ae10524ec7f;p=pandora-kernel.git ext4: Avoid data / filesystem corruption when write fails to copy data When ext4_write_begin fails after allocating some blocks or generic_perform_write fails to copy data to write, we truncate blocks already instantiated beyond i_size. Although these blocks were never inside i_size, we have to truncate the pagecache of these blocks so that corresponding buffers get unmapped. Otherwise subsequent __block_prepare_write (called because we are retrying the write) will find the buffers mapped, not call ->get_block, and thus the page will be backed by already freed blocks leading to filesystem and data corruption. Signed-off-by: Jan Kara Signed-off-by: "Theodore Ts'o" --- Reading git-diff-tree failed