ext4: fix ext4_da_write_begin error path
authorEric Sandeen <sandeen@redhat.com>
Sat, 2 Aug 2008 22:51:06 +0000 (18:51 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 2 Aug 2008 22:51:06 +0000 (18:51 -0400)
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>
fs/ext4/inode.c

index efe8caa3811c9df517cc1c8e9a31e5674722f71e..37f834bc7cd6df84a4d5c1e4b42c2f8bd425f337 100644 (file)
@@ -2280,8 +2280,11 @@ retry:
        }
 
        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,