]> git.ipfire.org Git - thirdparty/mdadm.git/commit
Incremental: Use ->validate_geometry instead of ->avail_size
authorNeilBrown <neilb@suse.com>
Mon, 30 Oct 2017 04:43:41 +0000 (15:43 +1100)
committerJes Sorensen <jsorensen@fb.com>
Wed, 1 Nov 2017 21:26:37 +0000 (17:26 -0400)
commit3bc6f786e1156d12ee466d732930bf71f6a8083a
tree9bd6d1bb680d2f585928c95096b3196ac7e16673
parent3d6a7c8472497c076702b76f63d0f84af1a3105e
Incremental: Use ->validate_geometry instead of ->avail_size

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 <bjornar.ness@gmail.com>
Fixes: 641da7459192 ("super1: separate to version of _avail_space1().")
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Incremental.c