aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorCurt Wohlgemuth <curtw@google.com>2009-07-17 10:54:08 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-07-17 10:54:08 -0400
commit6487a9d3b5476ffd1bbbe97e58cf26dbeb7a5d4a (patch)
tree6f03532934774f847e281a9eb52fbf539b36f42b /fs/ext4/inode.c
parentf6f50e28f0cb8d7bcdfaacc83129f005dede11b1 (diff)
ext4: More buffer head reference leaks
After the patch I posted last week regarding buffer head ref leaks in no-journal mode, I looked at all the code that uses buffer heads and searched for more potential leaks. The patch below fixes the issues I found; these can occur even when a journal is present. The change to inode.c fixes a double release if ext4_journal_get_create_access() fails. The changes to namei.c are more complicated. add_dirent_to_buf() will release the input buffer head EXCEPT when it returns -ENOSPC. There are some callers of this routine that don't always do the brelse() in the event that -ENOSPC is returned. Unfortunately, to put this fix into ext4_add_entry() required capturing the return value of make_indexed_dir() and add_dirent_to_buf(). Signed-off-by: Curt Wohlgemuth <curtw@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index f9c642b22efa..deb14a728791 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -762,8 +762,9 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode,
762 BUFFER_TRACE(bh, "call get_create_access"); 762 BUFFER_TRACE(bh, "call get_create_access");
763 err = ext4_journal_get_create_access(handle, bh); 763 err = ext4_journal_get_create_access(handle, bh);
764 if (err) { 764 if (err) {
765 /* Don't brelse(bh) here; it's done in
766 * ext4_journal_forget() below */
765 unlock_buffer(bh); 767 unlock_buffer(bh);
766 brelse(bh);
767 goto failed; 768 goto failed;
768 } 769 }
769 770