linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zram: Failing to decompress is WARN_ON worthy
@ 2020-09-18  0:41 Douglas Anderson
  2020-09-18 14:46 ` Minchan Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Douglas Anderson @ 2020-09-18  0:41 UTC (permalink / raw)
  To: Minchan Kim, Nitin Gupta, Sergey Senozhatsky
  Cc: sonnyrao, Douglas Anderson, Jens Axboe, linux-block, linux-kernel

If we fail to decompress in zram it's a pretty serious problem.  We
were entrusted to be able to decompress the old data but we failed.
Either we've got some crazy bug in the compression code or we've got
memory corruption.

At the moment, when this happens the log looks like this:

  ERR kernel: [ 1833.099861] zram: Decompression failed! err=-22, page=336112
  ERR kernel: [ 1833.099881] zram: Decompression failed! err=-22, page=336112
  ALERT kernel: [ 1833.099886] Read-error on swap-device (253:0:2688896)

It is true that we have an "ALERT" level log in there, but (at least
to me) it feels like even this isn't enough to impart the seriousness
of this error.  Let's convert to a WARN_ON.  Note that WARN_ON is
automatically "unlikely" so we can simply replace the old annotation
with the new one.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/block/zram/zram_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 9100ac36670a..a6e2f0980aff 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1268,7 +1268,7 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index,
 	zram_slot_unlock(zram, index);
 
 	/* Should NEVER happen. Return bio error if it does. */
-	if (unlikely(ret))
+	if (WARN_ON(ret))
 		pr_err("Decompression failed! err=%d, page=%u\n", ret, index);
 
 	return ret;
-- 
2.28.0.681.g6f77f65b4e-goog


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

end of thread, other threads:[~2020-09-18 14:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18  0:41 [PATCH] zram: Failing to decompress is WARN_ON worthy Douglas Anderson
2020-09-18 14:46 ` Minchan Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).