[dm-devel] [PATCH RESEND] dm-raid: Do not call BUG() in __rdev_sectors()

Heinz Mauelshagen heinzm at redhat.com
Thu Jun 29 14:09:38 UTC 2017


Hi Hannes,

thanks for your patch.

BUG() is intentional there to catch what I've already fixed with patch

"[dm-devel] [PATCH] dm raid: fix oops on upgrading to extended 
superblock format"

on 06/23/2017.

IOW: returning 0 is never right and would hide bugs like that one fixed.

Heinz


On 06/28/2017 10:04 AM, Hannes Reinecke wrote:
> __rdev_sectors() might be called for an invalid/non-existing
> RAID set during raid_ctr(), which is perfectly fine and no
> reason to panic.
>
> Signed-off-by: Hannes Reinecke <hare at suse.com>
> ---
>   drivers/md/dm-raid.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
> index 7d89322..9bbb596 100644
> --- a/drivers/md/dm-raid.c
> +++ b/drivers/md/dm-raid.c
> @@ -1571,7 +1571,8 @@ static sector_t __rdev_sectors(struct raid_set *rs)
>   			return rdev->sectors;
>   	}
>   
> -	BUG(); /* Constructor ensures we got some. */
> +	/* No valid raid devices */
> +	return 0;
>   }
>   
>   /* Calculate the sectors per device and per array used for @rs */




More information about the dm-devel mailing list