linux/drivers/block/zram
Sergey Senozhatsky d93435c3fb zram: check comp algorithm availability earlier
Improvement idea by Marcin Jabrzyk.

comp_algorithm_store() silently accepts any supplied algorithm name,
because zram performs algorithm availability check later, during the
device configuration phase in disksize_store() and emits the following
error:

  "zram: Cannot initialise %s compressing backend"

this error line is somewhat generic and, besides, can indicate a failed
attempt to allocate compression backend's working buffers.

add algorithm availability check to comp_algorithm_store():

  echo lzz > /sys/block/zram0/comp_algorithm
  -bash: echo: write error: Invalid argument

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reported-by: Marcin Jabrzyk <m.jabrzyk@samsung.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-06-25 17:00:37 -07:00
..
Kconfig zram: remove obsolete ZRAM_DEBUG option 2015-06-25 17:00:35 -07:00
Makefile zram: add lz4 algorithm backend 2014-04-07 16:36:01 -07:00
zcomp.c zram: check comp algorithm availability earlier 2015-06-25 17:00:37 -07:00
zcomp.h zram: check comp algorithm availability earlier 2015-06-25 17:00:37 -07:00
zcomp_lz4.c zram: add lz4 algorithm backend 2014-04-07 16:36:01 -07:00
zcomp_lz4.h zram: add lz4 algorithm backend 2014-04-07 16:36:01 -07:00
zcomp_lzo.c zram: introduce compressing backend abstraction 2014-04-07 16:36:01 -07:00
zcomp_lzo.h zram: introduce compressing backend abstraction 2014-04-07 16:36:01 -07:00
zram_drv.c zram: check comp algorithm availability earlier 2015-06-25 17:00:37 -07:00
zram_drv.h zram: close race by open overriding 2015-06-25 17:00:36 -07:00