Re: [PATCH -next 2/6] md: remove flag RemoveSynchronized

From: Song Liu
Date: Wed Oct 18 2023 - 13:54:17 EST


On Sun, Oct 15, 2023 at 6:28 PM Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> wrote:
>
> From: Yu Kuai <yukuai3@xxxxxxxxxx>
>
> rcu is not used correctly here, because synchronize_rcu() is called
> before replacing old value, for example:
>
> remove_and_add_spares // other path
> synchronize_rcu
> // called before replacing old value
> set_bit(RemoveSynchronized)
> rcu_read_lock()
> rdev = conf->mirros[].rdev
> pers->hot_remove_disk
> conf->mirros[].rdev = NULL;
> if (!test_bit(RemoveSynchronized))
> synchronize_rcu
> /*
> * won't be called, and won't wait
> * for concurrent readers to be done.
> /*
> // access rdev after remove_and_add_spares()
> rcu_read_unlock()

I am having a hard time following the description here. Please be more
specific about what issue we are fixing here.

Thanks,
Song

>
> Hence remove this flag and prepare to remove rcu protection to access
> rdev from 'conf'.
>
> Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx>
> ---
[...]