Re: [PATCH v4.9] dm: interlock pending dm_io and dm_wait_for_bios_completion

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

 



On Tue, May 03, 2022 at 04:35:44PM -0400, Mikulas Patocka wrote:
> This is backport of the patch 9f6dc6337610 ("dm: interlock pending dm_io
> and dm_wait_for_bios_completion") for the kernel 4.9.
> 
> The bugs fixed by this patch can cause random crashing when reloading dm
> table, so it is eligible for stable backport.
> 
> Note that the kernel 4.9 uses md->pending to count the number of
> in-progress I/Os and md->pending is decremented after dm_stats_account_io,
> so the race condition doesn't really exist there (except for missing
> smp_rmb()).
> 
> The percpu variable md->pending_io is not needed in the stable kernels,
> because md->pending counts the same value, so it is not backported.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>
> Reviewed-by: Mike Snitzer <snitzer@xxxxxxxxxx>
> 
> ---
>  drivers/md/dm.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> Index: linux-stable/drivers/md/dm.c
> ===================================================================
> --- linux-stable.orig/drivers/md/dm.c	2022-04-30 19:03:08.000000000 +0200
> +++ linux-stable/drivers/md/dm.c	2022-04-30 19:03:46.000000000 +0200
> @@ -2027,6 +2027,8 @@ static int dm_wait_for_completion(struct
>  	}
>  	finish_wait(&md->wait, &wait);
>  
> +	smp_rmb(); /* paired with atomic_dec_return in end_io_acct */
> +
>  	return r;
>  }
>  
> 

All now queued up, thanks.

gre gk-h

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux