[PATCH] xfs: always set rvalp in xfs_dir2_node_trim_free

Carlos Maiolino cmaiolino at redhat.com
Fri Mar 11 05:05:54 CST 2016


I was just sending this patch when I saw yours.

Looks good to me:

Reviewed-by: Carlos Maiolino <cmaiolino at redhat.com>

On Fri, Mar 11, 2016 at 10:42:17AM +0100, Christoph Hellwig wrote:
> xfs_dir2_node_trim_free can return with setting the rvalp argument
> pointer.  Initialize it to 0 at the beginning of the function and
> only update it to 1 if we succeeded trimming a freespace block.
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
> ---
>  fs/xfs/libxfs/xfs_dir2_node.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
> index 63ee03d..75a5574 100644
> --- a/fs/xfs/libxfs/xfs_dir2_node.c
> +++ b/fs/xfs/libxfs/xfs_dir2_node.c
> @@ -2235,6 +2235,9 @@ xfs_dir2_node_trim_free(
>  
>  	dp = args->dp;
>  	tp = args->trans;
> +
> +	*rvalp = 0;
> +
>  	/*
>  	 * Read the freespace block.
>  	 */
> @@ -2255,7 +2258,6 @@ xfs_dir2_node_trim_free(
>  	 */
>  	if (freehdr.nused > 0) {
>  		xfs_trans_brelse(tp, bp);
> -		*rvalp = 0;
>  		return 0;
>  	}
>  	/*
> -- 
> 2.1.4
> 
> _______________________________________________
> xfs mailing list
> xfs at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

-- 
Carlos



More information about the xfs mailing list