Re: [PATCH 4/7] md/raid10: raid10_write_request() drops the barrier before calling

"yu kuai" <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.raid
Message-ID <[email protected]>
Hi,

在 2026/6/23 15:24, Abd-Alrhman Masalkhi 写道:
> bio_submit_split_bioset() and reacquires it afterwards. This is
> unnecessary because bio_submit_split_bioset() does not require
> releasing the barrier protection.

Why is this safe?

It's possible plug is not enabled in this context, and the allocated new
aplit bio will be submitted and enter wait_barrier() again. wait_barrier()
is not supposed to be called recursively. Otherwise deadlock can happend:

t1: sync_thread grab barrier and waiting for nr_pending to be 0 from raise_barrier()
t2: wait_barrier() first inc nr_pending, then recursive wait_barrier() waiting
for barrier to be released.

>
> Remove the redundant allow_barrier()/wait_barrier() pair around
> bio_submit_split_bioset().
>
> Signed-off-by: Abd-Alrhman Masalkhi <[email protected]>
> ---
>   drivers/md/raid10.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 840f0446c231..4bc1d5553ec7 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -1493,10 +1493,8 @@ static bool raid10_write_request(struct mddev *mddev, struct bio *bio,
>   		if (atomic)
>   			goto err_handle;
>   
> -		allow_barrier(conf);
>   		bio = bio_submit_split_bioset(bio, r10_bio->sectors,
>   					      &conf->bio_split);
> -		wait_barrier(conf, false);
>   		if (!bio) {
>   			set_bit(R10BIO_Returned, &r10_bio->state);
>   			goto err_handle;

-- 
Thanks,
Kuai
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.