Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1546083 > unrolled thread

[PATCH v4 2/3] zram: revalidate disk under init_lock

Started byMinchan Kim <minchan@kernel.org>
First post2016-12-22 01:40 +0100
Last post2016-12-22 02:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v4 2/3] zram: revalidate disk under init_lock Minchan Kim <minchan@kernel.org> - 2016-12-22 01:40 +0100
    Re: [PATCH v4 2/3] zram: revalidate disk under init_lock Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-12-22 02:40 +0100

#1546083 — [PATCH v4 2/3] zram: revalidate disk under init_lock

FromMinchan Kim <minchan@kernel.org>
Date2016-12-22 01:40 +0100
Subject[PATCH v4 2/3] zram: revalidate disk under init_lock
Message-ID<sQZAl-23J-13@gated-at.bofh.it>
[1] moved revalidate_disk call out of init_lock to avoid lockdep
false-positive splat. However, [2] remove init_lock in IO path
so there is no worry about lockdep splat. So, let's restore it.
This patch need to set BDI_CAP_STABLE_WRITES atomically in
next patch.

[1] b4c5c60920e3: zram: avoid lockdep splat by revalidate_disk
[2] 08eee69fcf6b: zram: remove init_lock in zram_make_request

Fixes: da9556a2367c ("zram: user per-cpu compression streams")
Cc: <stable@vger.kernel.org> [4.7+]
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
 drivers/block/zram/zram_drv.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 15f58ab44d0b..195376b4472b 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1095,14 +1095,8 @@ static ssize_t disksize_store(struct device *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;
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1546117

FromSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date2016-12-22 02:40 +0100
Message-ID<sR0wp-2DI-5@gated-at.bofh.it>
In reply to#1546083
On (12/22/16 09:36), Minchan Kim wrote:
> [1] moved revalidate_disk call out of init_lock to avoid lockdep
> false-positive splat. However, [2] remove init_lock in IO path
> so there is no worry about lockdep splat. So, let's restore it.
> This patch need to set BDI_CAP_STABLE_WRITES atomically in
> next patch.
> 
> [1] b4c5c60920e3: zram: avoid lockdep splat by revalidate_disk
> [2] 08eee69fcf6b: zram: remove init_lock in zram_make_request
> 
> Fixes: da9556a2367c ("zram: user per-cpu compression streams")
> Cc: <stable@vger.kernel.org> [4.7+]
> Signed-off-by: Minchan Kim <minchan@kernel.org>

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web