https://github.com/torvalds/linux
Revision ad8d6f0a783ffa2ff9b0cf09910b889715772201 authored by Jens Axboe on 02 April 2006, 21:10:32 UTC, committed by Jens Axboe on 02 April 2006, 21:10:32 UTC
Thanks to Andrew for the good explanation of why this is so. akpm writes:

If a page is under writeback and we remove it from pagecache, it's still
going to get written to disk.  But the VFS no longer knows about that page,
nor that this page is about to modify disk blocks.

So there might be scenarios in which those
blocks-which-are-about-to-be-written-to get reused for something else.
When writeback completes, it'll scribble on those blocks.

This won't happen in ext2/ext3-style filesystems in normal mode because the
page has buffers and try_to_release_page() will fail.

But ext2 in nobh mode doesn't attach buffers at all - it just sticks the
page in a BIO, finds some new blocks, points the BIO at those blocks and
lets it rip.

While that write IO's in flight, someone could truncate the file.  Truncate
won't block on the writeout because the page isn't in pagecache any more.
So truncate will the free the blocks from the file under the page's feet.
Then something else can reallocate those blocks.  Then write data to them.

Now, the original write completes, corrupting the filesystem.

Signed-off-by: Jens Axboe <axboe@suse.de>
1 parent 059a8f3
History
Tip revision: ad8d6f0a783ffa2ff9b0cf09910b889715772201 authored by Jens Axboe on 02 April 2006, 21:10:32 UTC
[PATCH] splice: page stealing needs to wait_on_page_writeback()
Tip revision: ad8d6f0
File Mode Size
Documentation
arch
block
crypto
drivers
fs
include
init
ipc
kernel
lib
mm
net
scripts
security
sound
usr
.gitignore -rw-r--r-- 462 bytes
COPYING -rw-r--r-- 18.3 KB
CREDITS -rw-r--r-- 87.7 KB
Kbuild -rw-r--r-- 1.2 KB
MAINTAINERS -rw-r--r-- 67.3 KB
Makefile -rw-r--r-- 43.8 KB
README -rw-r--r-- 15.1 KB
REPORTING-BUGS -rw-r--r-- 3.0 KB

README

back to top