summaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4_jbd2.h
diff options
context:
space:
mode:
authorCurt Wohlgemuth <curtw@google.com>2009-07-13 15:07:20 +0200
committerTheodore Ts'o <tytso@mit.edu>2009-07-13 15:07:20 +0200
commite6b5d30104db5f34110678ecab14988f1f1eff63 (patch)
tree922408d70d388925f0113998649d56da475deff4 /fs/ext4/ext4_jbd2.h
parentext4: Move __ext4_journalled_writepage() to avoid forward declaration (diff)
downloadlinux-e6b5d30104db5f34110678ecab14988f1f1eff63.tar.xz
linux-e6b5d30104db5f34110678ecab14988f1f1eff63.zip
ext4: Fix buffer head reference leak in no-journal mode
We found a problem with buffer head reference leaks when using an ext4 partition without a journal. In particular, calls to ext4_forget() would not to a brelse() on the input buffer head, which will cause pages they belong to to not be reclaimable. Further investigation showed that all places where ext4_journal_forget() and ext4_journal_revoke() are called are subject to the same problem. The patch below changes __ext4_journal_forget/__ext4_journal_revoke to do an explicit release of the buffer head when the journal handle isn't valid. Signed-off-by: Curt Wohlgemuth <curtw@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4_jbd2.h')
-rw-r--r--fs/ext4/ext4_jbd2.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index d574a85aca56..139fb8cb87e4 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -131,9 +131,11 @@ int __ext4_journal_get_undo_access(const char *where, handle_t *handle,
int __ext4_journal_get_write_access(const char *where, handle_t *handle,
struct buffer_head *bh);
+/* When called with an invalid handle, this will still do a put on the BH */
int __ext4_journal_forget(const char *where, handle_t *handle,
struct buffer_head *bh);
+/* When called with an invalid handle, this will still do a put on the BH */
int __ext4_journal_revoke(const char *where, handle_t *handle,
ext4_fsblk_t blocknr, struct buffer_head *bh);