ext4: fix ext4_da_write_begin error path

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, August 4, 2008 - 11:00 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d5a0d4...
Commit:     d5a0d4f732af3438e592efab4cb80076d1dd81b5
Parent:     e9e34f4e8f42177c66754fec1edfd35e70c18f99
Author:     Eric Sandeen <sandeen@redhat.com>
AuthorDate: Sat Aug 2 18:51:06 2008 -0400
Committer:  Theodore Ts'o <tytso@mit.edu>
CommitDate: Sat Aug 2 18:51:06 2008 -0400

    ext4: fix ext4_da_write_begin error path
    
    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 |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index efe8caa..37f834b 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -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,
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ext4: fix ext4_da_write_begin error path, Linux Kernel Mailing ..., (Mon Aug 4, 11:00 am)