Patch "nbd: correct the maximum value for discard sectors" has been added to the 6.11-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    nbd: correct the maximum value for discard sectors

to the 6.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nbd-correct-the-maximum-value-for-discard-sectors.patch
and it can be found in the queue-6.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5cb1099c9a85fdf0558d199524fe1d57e2f58924
Author: Wouter Verhelst <w@xxxxxxx>
Date:   Mon Aug 12 15:20:42 2024 +0200

    nbd: correct the maximum value for discard sectors
    
    [ Upstream commit 296dbc72d29085d5fc34430d0760423071e9e81d ]
    
    The version of the NBD protocol implemented by the kernel driver
    currently has a 32 bit field for length values. As the NBD protocol uses
    bytes as a unit of length, length values larger than 2^32 bytes cannot
    be expressed.
    
    Update the max_hw_discard_sectors field to match that.
    
    Signed-off-by: Wouter Verhelst <w@xxxxxxx>
    Fixes: 268283244c0f ("nbd: use the atomic queue limits API in nbd_set_size")
    Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
    Cc: Eric Blake <eblake@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240812133032.115134-8-w@xxxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 69b9851b67982..8b243144fd64f 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -350,7 +350,7 @@ static int __nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
 
 	lim = queue_limits_start_update(nbd->disk->queue);
 	if (nbd->config->flags & NBD_FLAG_SEND_TRIM)
-		lim.max_hw_discard_sectors = UINT_MAX;
+		lim.max_hw_discard_sectors = UINT_MAX >> SECTOR_SHIFT;
 	else
 		lim.max_hw_discard_sectors = 0;
 	if (!(nbd->config->flags & NBD_FLAG_SEND_FLUSH)) {




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux