cluster: RHEL56 - libgfs2: dir_split_leaf needs to check for allocation failure

Bob Peterson rpeterso at fedoraproject.org
Sat Apr 10 04:53:01 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c952ad46246b8619b723852ab967a69f2bb80290
Commit:        c952ad46246b8619b723852ab967a69f2bb80290
Parent:        1faaeeacae5c868e72e327e821ba118da7cbd6cd
Author:        Bob Peterson <bob at ganesha.peterson>
AuthorDate:    Thu Jan 21 17:22:55 2010 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Fri Apr 9 23:33:16 2010 -0500

libgfs2: dir_split_leaf needs to check for allocation failure

When splitting directory leaf blocks, if an allocation fails
for some reason (e.g. corruption) it should throw an error
rather than plowing forward.

rhbz#455300
---
 gfs2/libgfs2/fs_ops.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index f670aa5..c36b0f3 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -896,7 +896,8 @@ static void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex,
 		    be32_to_cpu(dent->de_hash) < divider) {
 			name_len = be16_to_cpu(dent->de_name_len);
 
-			dirent_alloc(dip, nbh, name_len, &new);
+			if (dirent_alloc(dip, nbh, name_len, &new))
+				die("dir_split_leaf (3)\n");
 
 			new->de_inum = dent->de_inum;
 			new->de_hash = dent->de_hash;
@@ -922,7 +923,8 @@ static void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex,
 	} while (dent);
 
 	if (!moved) {
-		dirent_alloc(dip, nbh, 0, &new);
+		if (dirent_alloc(dip, nbh, 0, &new))
+			die("dir_split_leaf (4)\n");
 		new->de_inum.no_formal_ino = 0;
 	}
 
@@ -1098,7 +1100,8 @@ restart:
 				nleaf->lf_depth = leaf->lf_depth;
 				nleaf->lf_dirent_format = cpu_to_be32(GFS2_FORMAT_DE);
 
-				dirent_alloc(dip, nbh, len, &dent);
+				if (dirent_alloc(dip, nbh, len, &dent))
+					die("dir_split_leaf (3)\n");
 				dip->i_di.di_blocks++;
 				bmodified(dip->i_bh);
 				bmodified(bh);


More information about the cluster-commits mailing list