Re: [PATCH] mdadm: handle super == NULL case in avail_size1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 31 2017, Song Liu wrote:

> Summary:
>
> Handling super == NULL case in avail_size1() was removed a while
> back. However, it is still useful in the following stack:
>
> avail_size1() with st->sb == NULL
> array_try_spare() with st == NULL
> try_spare() with st == NULL
> Incremental() with st == NULL

I assume you mean "st->sb == NULL" in each case here?  What you have
written doesn't make sense.


>
> This patch adds the handling of super == NULL back to avail_size1().

I doubt this is the best thing to do.
If we don't have st->sb, calling avail_size doesn't make any sense.
Maybe we should be calling validate_geometry.

NeilBrown


>
> Signed-off-by: Song Liu <songliubraving@xxxxxx>
> ---
>  super1.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/super1.c b/super1.c
> index f6a1045..5e8d967 100644
> --- a/super1.c
> +++ b/super1.c
> @@ -2340,7 +2340,9 @@ static __u64 avail_size1(struct supertype *st, __u64 devsize,
>  	if (devsize < 24)
>  		return 0;
>  
> -	if (__le32_to_cpu(super->feature_map) & MD_FEATURE_BITMAP_OFFSET) {
> +	if (!super)
> +		bmspace = choose_bm_space(devsize);
> +	else if (__le32_to_cpu(super->feature_map) & MD_FEATURE_BITMAP_OFFSET) {
>  		/* hot-add. allow for actual size of bitmap */
>  		struct bitmap_super_s *bsb;
>  		bsb = (struct bitmap_super_s *)(((char*)super)+MAX_SB_SIZE);
> @@ -2350,7 +2352,7 @@ static __u64 avail_size1(struct supertype *st, __u64 devsize,
>  	}
>  
>  	/* Allow space for bad block log */
> -	if (super->bblog_size)
> +	if (super && super->bblog_size)
>  		bbspace = __le16_to_cpu(super->bblog_size);
>  
>  	if (st->minor_version < 0)
> -- 
> 2.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux