Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

zram: propagate read_from_bdev_async() errors

When read_from_bdev_async() fails to chain bio, for instance fails to
allocate request or bio, we need to propagate the error condition so that
upper layer is aware of it. zram already does that by setting
BLK_STS_IOERR ->bi_status, but only for sync reads. Change async read
path to return its error status so that async errors are also handled.

Link: https://lkml.kernel.org/r/20260316015354.114465-1-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Suggested-by: Brian Geffon <bgeffon@google.com>
Acked-by: Brian Geffon <bgeffon@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Richard Chang <richardycc@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Sergey Senozhatsky and committed by
Andrew Morton
bf989ade f0f6f787

+8 -7
+8 -7
drivers/block/zram/zram_drv.c
··· 1429 1429 queue_work(system_highpri_wq, &req->work); 1430 1430 } 1431 1431 1432 - static void read_from_bdev_async(struct zram *zram, struct page *page, 1433 - u32 index, unsigned long blk_idx, 1434 - struct bio *parent) 1432 + static int read_from_bdev_async(struct zram *zram, struct page *page, 1433 + u32 index, unsigned long blk_idx, 1434 + struct bio *parent) 1435 1435 { 1436 1436 struct zram_rb_req *req; 1437 1437 struct bio *bio; 1438 1438 1439 1439 req = kmalloc_obj(*req, GFP_NOIO); 1440 1440 if (!req) 1441 - return; 1441 + return -ENOMEM; 1442 1442 1443 1443 bio = bio_alloc(zram->bdev, 1, parent->bi_opf, GFP_NOIO); 1444 1444 if (!bio) { 1445 1445 kfree(req); 1446 - return; 1446 + return -ENOMEM; 1447 1447 } 1448 1448 1449 1449 req->zram = zram; ··· 1459 1459 __bio_add_page(bio, page, PAGE_SIZE, 0); 1460 1460 bio_inc_remaining(parent); 1461 1461 submit_bio(bio); 1462 + 1463 + return 0; 1462 1464 } 1463 1465 1464 1466 static void zram_sync_read(struct work_struct *w) ··· 1509 1507 return -EIO; 1510 1508 return read_from_bdev_sync(zram, page, index, blk_idx); 1511 1509 } 1512 - read_from_bdev_async(zram, page, index, blk_idx, parent); 1513 - return 0; 1510 + return read_from_bdev_async(zram, page, index, blk_idx, parent); 1514 1511 } 1515 1512 #else 1516 1513 static inline void reset_bdev(struct zram *zram) {};