Skip to content

Commit

Permalink
ext4: fix ext4_da_write_begin error path
Browse files Browse the repository at this point in the history
ext4_da_write_begin needs to call journal_stop before returning,
if the page allocation fails.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Acked-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Eric Sandeen authored and Theodore Ts'o committed Aug 2, 2008
1 parent e9e34f4 commit d5a0d4f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2280,8 +2280,11 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
}

page = __grab_cache_page(mapping, index);
if (!page)
return -ENOMEM;
if (!page) {
ext4_journal_stop(handle);
ret = -ENOMEM;
goto out;
}
*pagep = page;

ret = block_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
Expand Down

0 comments on commit d5a0d4f

Please sign in to comment.