[Ocfs2-tools-devel] A patch for function ocfs2_expand_dir in libocfs2.

Joel Becker Joel.Becker at oracle.com
Wed Apr 11 11:35:32 PDT 2007


On Wed, Apr 11, 2007 at 10:12:05AM +0800, tao.ma wrote:
> Set "cinode" to NULL after the function ocfs2_free_cached_inode.
> In the original code, if ocfs2_extend_allocation fails, another 
> ocfs2_free_cached_inode will be called at "bail" and make the program 
> segment fault.

Nice catch, sob.

Joel


> Index: libocfs2/expanddir.c
> ===================================================================
> --- libocfs2/expanddir.c	(revision 1338)
> +++ libocfs2/expanddir.c	(working copy)
> @@ -74,6 +74,7 @@ errcode_t ocfs2_expand_dir(ocfs2_filesys
>  
>  	if (used_blks >= totl_blks) {
>  		ocfs2_free_cached_inode(fs, cinode);
> +		cinode = NULL;
>  
>  		/* extend the directory */
>  		ret = ocfs2_extend_allocation(fs, dir, 1);

> _______________________________________________
> Ocfs2-tools-devel mailing list
> Ocfs2-tools-devel at oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel

-- 

"The only way to get rid of a temptation is to yield to it."
         - Oscar Wilde 

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list