[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170626025818.GB373@jagdpanzerIV.localdomain>
Date: Mon, 26 Jun 2017 11:58:18 +0900
From: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc: Sami Kerola <kerolasa@....fi>, Minchan Kim <minchan@...nel.org>,
Nitin Gupta <ngupta@...are.org>, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Karel Zak <kzak@...hat.com>,
util-linux <util-linux@...r.kernel.org>
Subject: Re: zram hot_add device busy
On (06/26/17 11:39), Sergey Senozhatsky wrote:
[..]
> ok... I don't think I see what we can do in zram about the
> issue in question.
... check init_done() in reset_store() and avoid the whole ->bd_openers
branch if the device is already reset?
// not compile tested. just a sketch. //
---
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index debee952dcc1..79b1a957a6bd 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1047,6 +1047,14 @@ static ssize_t reset_store(struct device *dev,
return -EINVAL;
zram = dev_to_zram(dev);
+
+ down_write(&zram->init_lock);
+ if (!init_done(zram)) {
+ up_write(&zram->init_lock);
+ return len;
+ }
+ up_write(&zram->init_lock);
+
bdev = bdget_disk(zram->disk, 0);
if (!bdev)
return -ENOMEM;
---
-ss
Powered by blists - more mailing lists