# Re: \[mdadm PATCH\] Incremental: Use -\>validate\_geometry instead of -\>avail\_size

- From: Jes Sorensen \<jes.sorensen@gmail.com\>
- Date: 2017-11-01 21:27:06 
- List: linux-raid
- Page: https://ratatoskr.run/linux-raid/2017/11/6637372
- Thread: https://ratatoskr.run/linux-raid/2017/10/6637346/t.md

```text
On 10/30/2017 12:43 AM, NeilBrown wrote:
> 
> Since mdadm 3.3 is has not been correct to call ->avail_size if
> metadata hasn't been read from the device.  ->validate_geometry
> should be used instead.
> 
> Unfortunately array_try_spare() didn't get the memo, and it can crash
> when adding a spare with no metdata.
> 
> So change it to use ->validate_geometry().
> 
> Only one place remains that uses ->avail_size(), and that is safe.
> 
> Also fix a comment with a typo.
> 
> Reported-and-tested-by: Bjørnar Ness <redacted>
> Fixes: 641da7459192 ("super1: separate to version of _avail_space1().")
> Signed-off-by: NeilBrown <redacted>
> ---
>  Incremental.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)

Memo sent to array_try_spare()!

Thanks,
Jes


```
