linux/drivers/block/zram
David Carlier a8b5875741 zram: fix slot lock bit position on big-endian 64-bit
The slot lock is a bit operation on the whole __lock word, which flags and
ac_time alias as two u32s.  On little-endian the lock bit lands in the
position ZRAM_ENTRY_LOCK reserves in flags, so the aliasing works out.  On
64-bit big-endian it lands in ac_time instead: with
ZRAM_TRACK_ENTRY_ACTIME enabled, storing the access time from
mark_slot_accessed() or slot_free() wipes out the held lock bit, letting
another CPU take the same slot lock; an access time value with that bit
set makes the slot look locked forever.

Shift the lock bit into the flags half of the word on big-endian 64-bit.

Link: https://lore.kernel.org/20260810202241.2436603-1-devnexen@gmail.com
Fixes: 2e8ff2f51d ("zram: use u32 for entry ac_time tracking")
Signed-off-by: David Carlier <devnexen@gmail.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2026-08-24 18:43:19 -07:00
..
backend_842.c zram: validate parameters in each backend's setup_params 2026-08-24 18:43:04 -07:00
backend_842.h zram: add 842 compression backend support 2024-09-09 16:39:08 -07:00
backend_deflate.c zram: validate parameters in each backend's setup_params 2026-08-24 18:43:04 -07:00
backend_deflate.h zram: add zlib compression backend support 2024-09-09 16:39:08 -07:00
backend_lz4.c zram: validate parameters in each backend's setup_params 2026-08-24 18:43:04 -07:00
backend_lz4.h zram: add lz4 compression backend support 2024-09-09 16:39:07 -07:00
backend_lz4hc.c zram: validate parameters in each backend's setup_params 2026-08-24 18:43:04 -07:00
backend_lz4hc.h zram: add lz4hc compression backend support 2024-09-09 16:39:07 -07:00
backend_lzo.c zram: validate parameters in each backend's setup_params 2026-08-24 18:43:04 -07:00
backend_lzo.h zram: add lzo and lzorle compression backends support 2024-09-09 16:39:07 -07:00
backend_lzorle.c zram: validate parameters in each backend's setup_params 2026-08-24 18:43:04 -07:00
backend_lzorle.h zram: add lzo and lzorle compression backends support 2024-09-09 16:39:07 -07:00
backend_zstd.c zram: validate parameters in each backend's setup_params 2026-08-24 18:43:04 -07:00
backend_zstd.h zram: add zstd compression backend support 2024-09-09 16:39:08 -07:00
Kconfig zram: ZRAM_DEF_COMP should depend on ZRAM 2024-11-11 17:22:27 -08:00
Makefile zram: add 842 compression backend support 2024-09-09 16:39:08 -07:00
zcomp.c zram: use statically allocated compression algorithm names 2026-04-05 13:53:07 -07:00
zcomp.h zram: use statically allocated compression algorithm names 2026-04-05 13:53:07 -07:00
zram_drv.c zram: fix slot lock bit position on big-endian 64-bit 2026-08-24 18:43:19 -07:00
zram_drv.h zram: fix slot lock bit position on big-endian 64-bit 2026-08-24 18:43:19 -07:00