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

Joel Becker jlbec at evilplan.org
Thu Jan 31 11:35:22 PST 2013


Acked-by: Joel Becker <jlbec at evilplan.org>

On Thu, Jan 31, 2013 at 09:52:53AM -0600, Goldwyn Rodrigues wrote:
> 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)
> 
> _______________________________________________
> Ocfs2-tools-devel mailing list
> Ocfs2-tools-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel

-- 

Life's Little Instruction Book #407

	"Every once in a while, take the scenic route."

			http://www.jlbec.org/
			jlbec at evilplan.org



More information about the Ocfs2-tools-devel mailing list