zram: Fix deadlock bug in partial read/write
zram: Fix deadlock bug in partial read/write

Now zram allocates new page with GFP_KERNEL in zram I/O path
if IO is partial. Unfortunately, It may cause deadlock with
reclaim path like below.

write_page from fs
fs_lock
allocation(GFP_KERNEL)
reclaim
pageout
				write_page from fs
				fs_lock <-- deadlock

This patch fixes it by using GFP_NOIO.  In read path, we
reorganize code flow so that kmap_atomic is called after the
GFP_NOIO allocation.

Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org
Acked-by: Jerome Marchand <467c5ac8fe5b7f0600865381f402bd9cea4b8031@redhat.com>
Acked-by: Nitin Gupta <cc4fec8a34766005dd45d48be045c08d736c11ed@vflare.org>
[ add4fcd06328a394f0ad91feda7ee057316dc5ed@kernel.org: don't use GFP_ATOMIC ]
Signed-off-by: Pekka Enberg <add4fcd06328a394f0ad91feda7ee057316dc5ed@kernel.org>
Signed-off-by: Minchan Kim <eee62f459f15dcddf87a8df69e8328e2a2562028@kernel.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs