Skip to contentSkip to conversation

Patch "zram: revalidate disk under init_lock" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jan 17, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

zram: revalidate disk under init_lock

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
zram-revalidate-disk-under-init_lock.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From e7ccfc4ccb703e0f033bd4617580039898e912dd Mon Sep 17 00:00:00 2001

From: Minchan Kim <[email protected]>
Date: Tue, 10 Jan 2017 16:58:18 -0800
Subject: zram: revalidate disk under init_lock

From: Minchan Kim <[email protected]>

commit e7ccfc4ccb703e0f033bd4617580039898e912dd upstream.

Commit b4c5c60920e3 ("zram: avoid lockdep splat by revalidate_disk") moved revalidate_disk call out of init_lock to avoid lockdep false-positive splat. However, commit 08eee69fcf6b ("zram: remove init_lock in zram_make_request") removed init_lock in IO path so there is no worry about lockdep splat. So, let's restore it.

This patch is needed to set BDI_CAP_STABLE_WRITES atomically in next patch.

Fixes da9556a2367c ("zram: user per-cpu compression streams")
Cc Takashi Iwai <[email protected]>
Cc Hyeoncheol Lee <[email protected]>
Cc Sangseok Lee <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Darrick J. Wong <[email protected]>
---
 drivers/block/zram/zram_drv.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/block/zram/zram_drv.c +1 -7
@@ -1094,14 +1094,8 @@ static ssize_t disksize_store(struct dev
 	zram->comp = comp;
 	zram->disksize = disksize;
 	set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
-	up_write(&zram->init_lock);
-
-	/*
-	 * Revalidate disk out of the init_lock to avoid lockdep splat.
-	 * It's okay because disk's capacity is protected by init_lock
-	 * so that revalidate_disk always sees up-to-date capacity.
-	 */
 	revalidate_disk(zram->disk);
+	up_write(&zram->init_lock);
 
 	return len;
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/zram-support-bdi_cap_stable_writes.patch queue-4.9/zram-revalidate-disk-under-init_lock.patch queue-4.9/mm-pmd-dirty-emulation-in-page-fault-handler.patch