[PATCH 2/4] zram: call bio_endio() on early return in zram_bio_discard()
From: Andrew Stellman
Date: Tue Apr 07 2026 - 08:39:19 EST
When a discard request fits entirely within the unaligned head
fragment, zram_bio_discard() returns early without calling
bio_endio(bio). The bio is never completed, leaving the caller waiting
indefinitely. The normal exit path at the end of the function does call
bio_endio(), but the early return bypasses it.
Add bio_endio(bio) before the early return so the bio is properly
completed in all paths.
Signed-off-by: Andrew Stellman <astellman@xxxxxxxxxxxxxxxxxxx>
---
drivers/block/zram/zram_drv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index f41f1ca..8ea2a12 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -2701,8 +2701,10 @@ static void zram_bio_discard(struct zram *zram, struct bio *bio)
* skipping this logical block is appropriate here.
*/
if (offset) {
- if (n <= (PAGE_SIZE - offset))
+ if (n <= (PAGE_SIZE - offset)) {
+ bio_endio(bio);
return;
+ }
n -= (PAGE_SIZE - offset);
index++;
--
2.34.1