udf: Fix data corruption for files in ICB
authorJan Kara <jack@suse.cz>
Wed, 5 Sep 2012 13:48:23 +0000 (15:48 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 19 Sep 2012 14:04:43 +0000 (15:04 +0100)
commit0658632e16cba7cd399dd9380ac48531415f46e4
tree0dba8fb93c748205e86ff4927743e9272db62f30
parent241ee90a69ede9cf9255df1a18036210beeb8adf
udf: Fix data corruption for files in ICB

commit 9c2fc0de1a6e638fe58c354a463f544f42a90a09 upstream.

When a file is stored in ICB (inode), we overwrite part of the file, and
the page containing file's data is not in page cache, we end up corrupting
file's data by overwriting them with zeros. The problem is we use
simple_write_begin() which simply zeroes parts of the page which are not
written to. The problem has been introduced by be021ee4 (udf: convert to
new aops).

Fix the problem by providing a ->write_begin function which makes the page
properly uptodate.

Reported-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/udf/file.c