Skip to content

Commit 98d34c0

Browse files
Christoph Hellwigaxboe
authored andcommitted
xen-blkfront: fix sector_size propagation to the block layer
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: ba3f67c ("xen-blkfront: atomically update queue limits") Reported-by: Rusty Bird <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Roger Pau Monné <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 1c0b3fc commit 98d34c0

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

drivers/block/xen-blkfront.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,8 +1070,7 @@ static char *encode_disk_name(char *ptr, unsigned int n)
10701070
}
10711071

10721072
static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
1073-
struct blkfront_info *info, u16 sector_size,
1074-
unsigned int physical_sector_size)
1073+
struct blkfront_info *info)
10751074
{
10761075
struct queue_limits lim = {};
10771076
struct gendisk *gd;
@@ -1165,8 +1164,6 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
11651164

11661165
info->rq = gd->queue;
11671166
info->gd = gd;
1168-
info->sector_size = sector_size;
1169-
info->physical_sector_size = physical_sector_size;
11701167

11711168
xlvbd_flush(info);
11721169

@@ -2320,8 +2317,6 @@ static void blkfront_gather_backend_features(struct blkfront_info *info)
23202317
static void blkfront_connect(struct blkfront_info *info)
23212318
{
23222319
unsigned long long sectors;
2323-
unsigned long sector_size;
2324-
unsigned int physical_sector_size;
23252320
int err, i;
23262321
struct blkfront_ring_info *rinfo;
23272322

@@ -2360,7 +2355,7 @@ static void blkfront_connect(struct blkfront_info *info)
23602355
err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
23612356
"sectors", "%llu", &sectors,
23622357
"info", "%u", &info->vdisk_info,
2363-
"sector-size", "%lu", &sector_size,
2358+
"sector-size", "%lu", &info->sector_size,
23642359
NULL);
23652360
if (err) {
23662361
xenbus_dev_fatal(info->xbdev, err,
@@ -2374,9 +2369,9 @@ static void blkfront_connect(struct blkfront_info *info)
23742369
* provide this. Assume physical sector size to be the same as
23752370
* sector_size in that case.
23762371
*/
2377-
physical_sector_size = xenbus_read_unsigned(info->xbdev->otherend,
2372+
info->physical_sector_size = xenbus_read_unsigned(info->xbdev->otherend,
23782373
"physical-sector-size",
2379-
sector_size);
2374+
info->sector_size);
23802375
blkfront_gather_backend_features(info);
23812376
for_each_rinfo(info, rinfo, i) {
23822377
err = blkfront_setup_indirect(rinfo);
@@ -2388,8 +2383,7 @@ static void blkfront_connect(struct blkfront_info *info)
23882383
}
23892384
}
23902385

2391-
err = xlvbd_alloc_gendisk(sectors, info, sector_size,
2392-
physical_sector_size);
2386+
err = xlvbd_alloc_gendisk(sectors, info);
23932387
if (err) {
23942388
xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s",
23952389
info->xbdev->otherend);

0 commit comments

Comments
 (0)