On Sun, Apr 07 2024 at  9:19P -0400,
Ming Lei <[email protected]> wrote:

> When one stacking device is over one device with virt_boundary_mask and
> another one with max segment size, the stacking device have both limits
> set. This way is allowed before d690cb8ae14b ("block: add an API to
> atomically update queue limits").
> 
> Relax the limit so that we won't break such kind of stacking setting.
> 
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218687
> Reported-by: [email protected]
> Fixes: d690cb8ae14b ("block: add an API to atomically update queue limits")
> Link: https://lore.kernel.org/linux-block/ZfGl8HzUpiOxCLm3@fedora/
> Cc: Christoph Hellwig <[email protected]>
> Cc: Mike Snitzer <[email protected]>
> Cc: [email protected]
> Cc: Song Liu <[email protected]>
> Cc: [email protected]
> Signed-off-by: Ming Lei <[email protected]>
> ---
>  block/blk-settings.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index cdbaef159c4b..d2731843f2fc 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -182,17 +182,13 @@ static int blk_validate_limits(struct queue_limits *lim)
>               return -EINVAL;
>  
>       /*
> -      * Devices that require a virtual boundary do not support scatter/gather
> -      * I/O natively, but instead require a descriptor list entry for each
> -      * page (which might not be identical to the Linux PAGE_SIZE).  Because
> -      * of that they are not limited by our notion of "segment size".
> +      * Stacking device may have both virtual boundary and max segment
> +      * size limit, so allow this setting now, and long-term the two
> +      * might need to move out of stacking limits since we have immutable
> +      * bvec and lower layer bio splitting is supposed to handle the two
> +      * correctly.
>        */
> -     if (lim->virt_boundary_mask) {
> -             if (WARN_ON_ONCE(lim->max_segment_size &&
> -                              lim->max_segment_size != UINT_MAX))
> -                     return -EINVAL;
> -             lim->max_segment_size = UINT_MAX;
> -     } else {
> +     if (!lim->virt_boundary_mask) {
>               /*
>                * The maximum segment size has an odd historic 64k default that
>                * drivers probably should override.  Just like the I/O size we
> -- 
> 2.41.0
> 

Reviewed-by: Mike Snitzer <[email protected]>

Reply via email to