summaryrefslogtreecommitdiff
path: root/crypto/internal.h
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2013-08-17 10:02:33 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-08-17 10:02:33 -0400
commit5f1132b2ba8c873f25982cf45917e8455fb6c962 (patch)
tree91aeeb9c2268a57f9138dc571260b5b3692508ba /crypto/internal.h
parent09930042a2e94cf8ee79d22943915612c1e4ba51 (diff)
ext4: fix ext4_writepages() in presence of truncate
Inode size can arbitrarily change while writeback is in progress. When ext4_writepages() has prepared a long extent for mapping and truncate then reduces i_size, mpage_map_and_submit_buffers() will always map just one buffer in a page instead of all of them due to lblk < blocks check. So we end up not using all blocks we've allocated (thus leaking them) and also delalloc accounting goes wrong manifesting as a warning like: ext4_da_release_space:1333: ext4_da_release_space: ino 12, to_free 1 with only 0 reserved data blocks Note that the problem can happen only when blocksize < pagesize because otherwise we have only a single buffer in the page. Fix the problem by removing the size check from the mapping loop. We have an extent allocated so we have to use it all before checking for i_size. We also rename add_page_bufs_to_extent() to mpage_process_page_bufs() and make that function submit the page for IO if all buffers (upto EOF) in it are mapped. Reported-by: Dave Jones <davej@redhat.com> Reported-by: Zheng Liu <gnehzuil.liu@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: stable@vger.kernel.org
Diffstat (limited to 'crypto/internal.h')
0 files changed, 0 insertions, 0 deletions