public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen-blkfront: fix sector_size propagation to the block layer
@ 2024-06-25  5:52 Christoph Hellwig
  2024-06-25  8:45 ` Roger Pau Monné
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christoph Hellwig @ 2024-06-25  5:52 UTC (permalink / raw)
  To: roger.pau; +Cc: jgross, marmarek, xen-devel, linux-block, Rusty Bird

Ensure that info->sector_size and info->physical_sector_size are set
before the call to blkif_set_queue_limits by doing away with the
local variables and arguments that propagate them.

Thanks to Marek Marczykowski-Górecki and Jürgen Groß for root causing
the issue.

Fixes: ba3f67c11638 ("xen-blkfront: atomically update queue limits")
Reported-by: Rusty Bird <rustybird@net-c.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/xen-blkfront.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index fa3a2ba525458b..59ce113b882a0e 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1070,8 +1070,7 @@ static char *encode_disk_name(char *ptr, unsigned int n)
 }
 
 static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
-		struct blkfront_info *info, u16 sector_size,
-		unsigned int physical_sector_size)
+		struct blkfront_info *info)
 {
 	struct queue_limits lim = {};
 	struct gendisk *gd;
@@ -1165,8 +1164,6 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
 
 	info->rq = gd->queue;
 	info->gd = gd;
-	info->sector_size = sector_size;
-	info->physical_sector_size = physical_sector_size;
 
 	xlvbd_flush(info);
 
@@ -2320,8 +2317,6 @@ static void blkfront_gather_backend_features(struct blkfront_info *info)
 static void blkfront_connect(struct blkfront_info *info)
 {
 	unsigned long long sectors;
-	unsigned long sector_size;
-	unsigned int physical_sector_size;
 	int err, i;
 	struct blkfront_ring_info *rinfo;
 
@@ -2360,7 +2355,7 @@ static void blkfront_connect(struct blkfront_info *info)
 	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
 			    "sectors", "%llu", &sectors,
 			    "info", "%u", &info->vdisk_info,
-			    "sector-size", "%lu", &sector_size,
+			    "sector-size", "%lu", &info->sector_size,
 			    NULL);
 	if (err) {
 		xenbus_dev_fatal(info->xbdev, err,
@@ -2374,9 +2369,9 @@ static void blkfront_connect(struct blkfront_info *info)
 	 * provide this. Assume physical sector size to be the same as
 	 * sector_size in that case.
 	 */
-	physical_sector_size = xenbus_read_unsigned(info->xbdev->otherend,
+	info->physical_sector_size = xenbus_read_unsigned(info->xbdev->otherend,
 						    "physical-sector-size",
-						    sector_size);
+						    info->sector_size);
 	blkfront_gather_backend_features(info);
 	for_each_rinfo(info, rinfo, i) {
 		err = blkfront_setup_indirect(rinfo);
@@ -2388,8 +2383,7 @@ static void blkfront_connect(struct blkfront_info *info)
 		}
 	}
 
-	err = xlvbd_alloc_gendisk(sectors, info, sector_size,
-				  physical_sector_size);
+	err = xlvbd_alloc_gendisk(sectors, info);
 	if (err) {
 		xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s",
 				 info->xbdev->otherend);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen-blkfront: fix sector_size propagation to the block layer
  2024-06-25  5:52 [PATCH] xen-blkfront: fix sector_size propagation to the block layer Christoph Hellwig
@ 2024-06-25  8:45 ` Roger Pau Monné
  2024-07-02  7:33 ` Juergen Gross
  2024-07-02 14:58 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Roger Pau Monné @ 2024-06-25  8:45 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: jgross, marmarek, xen-devel, linux-block, Rusty Bird

On Tue, Jun 25, 2024 at 07:52:38AM +0200, Christoph Hellwig wrote:
> Ensure that info->sector_size and info->physical_sector_size are set
> before the call to blkif_set_queue_limits by doing away with the
> local variables and arguments that propagate them.
> 
> Thanks to Marek Marczykowski-Górecki and Jürgen Groß for root causing
> the issue.
> 
> Fixes: ba3f67c11638 ("xen-blkfront: atomically update queue limits")
> Reported-by: Rusty Bird <rustybird@net-c.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Thanks for debugging this.

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Roger.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen-blkfront: fix sector_size propagation to the block layer
  2024-06-25  5:52 [PATCH] xen-blkfront: fix sector_size propagation to the block layer Christoph Hellwig
  2024-06-25  8:45 ` Roger Pau Monné
@ 2024-07-02  7:33 ` Juergen Gross
  2024-07-02 14:58 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2024-07-02  7:33 UTC (permalink / raw)
  To: Christoph Hellwig, roger.pau; +Cc: marmarek, xen-devel, linux-block, Rusty Bird


[-- Attachment #1.1.1: Type: text/plain, Size: 570 bytes --]

On 25.06.24 07:52, Christoph Hellwig wrote:
> Ensure that info->sector_size and info->physical_sector_size are set
> before the call to blkif_set_queue_limits by doing away with the
> local variables and arguments that propagate them.
> 
> Thanks to Marek Marczykowski-Górecki and Jürgen Groß for root causing
> the issue.
> 
> Fixes: ba3f67c11638 ("xen-blkfront: atomically update queue limits")
> Reported-by: Rusty Bird <rustybird@net-c.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

I guess this should go through the block tree?


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen-blkfront: fix sector_size propagation to the block layer
  2024-06-25  5:52 [PATCH] xen-blkfront: fix sector_size propagation to the block layer Christoph Hellwig
  2024-06-25  8:45 ` Roger Pau Monné
  2024-07-02  7:33 ` Juergen Gross
@ 2024-07-02 14:58 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2024-07-02 14:58 UTC (permalink / raw)
  To: roger.pau, Christoph Hellwig
  Cc: jgross, marmarek, xen-devel, linux-block, Rusty Bird


On Tue, 25 Jun 2024 07:52:38 +0200, Christoph Hellwig wrote:
> Ensure that info->sector_size and info->physical_sector_size are set
> before the call to blkif_set_queue_limits by doing away with the
> local variables and arguments that propagate them.
> 
> Thanks to Marek Marczykowski-Górecki and Jürgen Groß for root causing
> the issue.
> 
> [...]

Applied, thanks!

[1/1] xen-blkfront: fix sector_size propagation to the block layer
      commit: 98d34c087249d39838874b83e17671e7d5eb1ca7

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-07-02 14:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25  5:52 [PATCH] xen-blkfront: fix sector_size propagation to the block layer Christoph Hellwig
2024-06-25  8:45 ` Roger Pau Monné
2024-07-02  7:33 ` Juergen Gross
2024-07-02 14:58 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox