Skip to content

Commit 2d1f18e

Browse files
sergey-senozhatskygregkh
authored andcommitted
zram: do not forget to endio for partial discard requests
commit e3668b3 upstream. As reported by Qu Wenruo and Avinesh Kumar, the following getconf PAGESIZE 65536 blkdiscard -p 4k /dev/zram0 takes literally forever to complete. zram doesn't support partial discards and just returns immediately w/o doing any discard work in such cases. The problem is that we forget to endio on our way out, so blkdiscard sleeps forever in submit_bio_wait(). Fix this by jumping to end_bio label, which does bio_endio(). Link: https://lore.kernel.org/20260331074255.777019-1-senozhatsky@chromium.org Fixes: 0120dd6 ("zram: make zram_bio_discard more self-contained") Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> Reported-by: Qu Wenruo <wqu@suse.com> Closes: https://lore.kernel.org/linux-block/92361cd3-fb8b-482e-bc89-15ff1acb9a59@suse.com Tested-by: Qu Wenruo <wqu@suse.com> Reported-by: Avinesh Kumar <avinesh.kumar@suse.com> Closes: https://bugzilla.suse.com/show_bug.cgi?id=1256530 Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Brian Geffon <bgeffon@google.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Minchan Kim <minchan@kernel.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 108f2cd commit 2d1f18e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/block/zram/zram_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1880,7 +1880,7 @@ static void zram_bio_discard(struct zram *zram, struct bio *bio)
18801880
*/
18811881
if (offset) {
18821882
if (n <= (PAGE_SIZE - offset))
1883-
return;
1883+
goto end_bio;
18841884

18851885
n -= (PAGE_SIZE - offset);
18861886
index++;
@@ -1895,6 +1895,7 @@ static void zram_bio_discard(struct zram *zram, struct bio *bio)
18951895
n -= PAGE_SIZE;
18961896
}
18971897

1898+
end_bio:
18981899
bio_endio(bio);
18991900
}
19001901

0 commit comments

Comments
 (0)