Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 3e89cfb766711d210e23284206b791eee71273f7
Parent: 53028729cd3b8987ee498d486c6cae37c60b808b
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Thu Jan 21 17:22:55 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Tue Jan 26 14:39:29 2010 -0600
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 3fc80ce..35721fa 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -899,7 +899,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;
@@ -925,7 +926,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;
}
@@ -1105,7 +1107,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);