[Ocfs2-tools-devel] [PATCH] libocfs2: Change asserts to error
    Goldwyn Rodrigues 
    rgoldwyn at gmail.com
       
    Thu Jan 31 07:52:53 PST 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.
Signed-off-by: Goldwyn Rodrigues <rgoldwyn at suse.com>
---
diff --git a/libocfs2/dir_indexed.c b/libocfs2/dir_indexed.c
index 41e0f80..7dc12d3 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)
    
    
More information about the Ocfs2-tools-devel
mailing list