[Ocfs2-tools-devel] [PATCH] libocfs2: Change asserts to error

Goldwyn Rodrigues rgoldwyn at suse.de
Mon Sep 30 06:56:49 PDT 2013


While running fsck.ocfs2, if an assert is met, fsck.ocfs2 terminates.
This error is still recoverable, because the index of the directory
can be rebuilt. Converting the asserts to an error would return
control to fsck.

This patch has been acked by Joel:
https://oss.oracle.com/pipermail/ocfs2-tools-devel/2013-January/004108.html

Signed-off-by: Goldwyn Rodrigues <rgoldwyn at suse.com>
---
 libocfs2/dir_indexed.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libocfs2/dir_indexed.c b/libocfs2/dir_indexed.c
index 41e0f80..8fa3e6f 100644
--- a/libocfs2/dir_indexed.c
+++ b/libocfs2/dir_indexed.c
@@ -1436,9 +1436,11 @@ errcode_t ocfs2_dx_dir_search(ocfs2_filesys *fs,
 		entry_list = &dx_leaf->dl_list;
 	}
 
-	assert(entry_list->de_count > 0);
-	assert(entry_list->de_num_used > 0);
-	assert(dx_root->dr_num_entries > 0);
+	if ((entry_list->de_count == 0) || (entry_list->de_num_used == 0) ||
+			(dx_root->dr_num_entries == 0)) {
+		ret = OCFS2_ET_DIR_CORRUPTED;
+		goto out;
+	}
 
 	ret = ocfs2_malloc_block(fs->fs_io, &dir_buf);
 	if (ret)
-- 
1.8.1.4


-- 
Goldwyn



More information about the Ocfs2-tools-devel mailing list