[PATCH 4/8] GFS2: remove dependency on __GFP_NOFAIL

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Steven Whitehouse
Date: Monday, August 2, 2010 - 2:27 am

From: David Rientjes <rientjes@google.com>

The k[mc]allocs in dr_split_leaf() and dir_double_exhash() are failable,
so remove __GFP_NOFAIL from their masks.

Cc: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 6b48d7c..b9dd88a 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -955,7 +955,12 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
 	/* Change the pointers.
 	   Don't bother distinguishing stuffed from non-stuffed.
 	   This code is complicated enough already. */
-	lp = kmalloc(half_len * sizeof(__be64), GFP_NOFS | __GFP_NOFAIL);
+	lp = kmalloc(half_len * sizeof(__be64), GFP_NOFS);
+	if (!lp) {
+		error = -ENOMEM;
+		goto fail_brelse;
+	}
+
 	/*  Change the pointers  */
 	for (x = 0; x < half_len; x++)
 		lp[x] = cpu_to_be64(bn);
@@ -1063,7 +1068,9 @@ static int dir_double_exhash(struct gfs2_inode *dip)
 
 	/*  Allocate both the "from" and "to" buffers in one big chunk  */
 
-	buf = kcalloc(3, sdp->sd_hash_bsize, GFP_NOFS | __GFP_NOFAIL);
+	buf = kcalloc(3, sdp->sd_hash_bsize, GFP_NOFS);
+	if (!buf)
+		return -ENOMEM;
 
 	for (block = dip->i_disksize >> sdp->sd_hash_bsize_shift; block--;) {
 		error = gfs2_dir_read_data(dip, (char *)buf,
-- 
1.7.1.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
GFS2: Pre-pull patch posting, Steven Whitehouse, (Mon Aug 2, 2:27 am)
[PATCH 1/8] GFS2: Use nobh_writepage, Steven Whitehouse, (Mon Aug 2, 2:27 am)
[PATCH 3/8] GFS2: Simplify gfs2_write_alloc_required, Steven Whitehouse, (Mon Aug 2, 2:27 am)
[PATCH 4/8] GFS2: remove dependency on __GFP_NOFAIL, Steven Whitehouse, (Mon Aug 2, 2:27 am)
[PATCH 7/8] GFS2: Fix typo in stuffed file data copy handling, Steven Whitehouse, (Mon Aug 2, 2:27 am)
[PATCH 8/8] GFS2: Fix recovery stuck bug (try #2), Steven Whitehouse, (Mon Aug 2, 2:27 am)