diff options
author | Jan Kara <jack@suse.cz> | 2015-11-24 15:34:35 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2015-11-24 15:34:35 -0500 |
commit | bc23f0c8d7ccd8d924c4e70ce311288cb3e61ea8 (patch) | |
tree | 8be0d8ff60e01e6f818570f933c5082ea4731a72 /block/cfq-iosched.c | |
parent | a4dad1ae24f850410c4e60f22823cba1289b8d52 (diff) | |
download | blackbird-obmc-linux-bc23f0c8d7ccd8d924c4e70ce311288cb3e61ea8.tar.gz blackbird-obmc-linux-bc23f0c8d7ccd8d924c4e70ce311288cb3e61ea8.zip |
jbd2: Fix unreclaimed pages after truncate in data=journal mode
Ted and Namjae have reported that truncated pages don't get timely
reclaimed after being truncated in data=journal mode. The following test
triggers the issue easily:
for (i = 0; i < 1000; i++) {
pwrite(fd, buf, 1024*1024, 0);
fsync(fd);
fsync(fd);
ftruncate(fd, 0);
}
The reason is that journal_unmap_buffer() finds that truncated buffers
are not journalled (jh->b_transaction == NULL), they are part of
checkpoint list of a transaction (jh->b_cp_transaction != NULL) and have
been already written out (!buffer_dirty(bh)). We clean such buffers but
we leave them in the checkpoint list. Since checkpoint transaction holds
a reference to the journal head, these buffers cannot be released until
the checkpoint transaction is cleaned up. And at that point we don't
call release_buffer_page() anymore so pages detached from mapping are
lingering in the system waiting for reclaim to find them and free them.
Fix the problem by removing buffers from transaction checkpoint lists
when journal_unmap_buffer() finds out they don't have to be there
anymore.
Reported-and-tested-by: Namjae Jeon <namjae.jeon@samsung.com>
Fixes: de1b794130b130e77ffa975bb58cb843744f9ae5
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 'block/cfq-iosched.c')
0 files changed, 0 insertions, 0 deletions