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


Groups > linux.kernel > #1674410

Re: zram hot_add device busy

From Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Newsgroups linux.kernel
Subject Re: zram hot_add device busy
Date 2017-06-26 05:00 +0200
Message-ID <tWspQ-502-5@gated-at.bofh.it> (permalink)
References <tVQaR-6vZ-13@gated-at.bofh.it> <tWs6t-4SO-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

zram hot_add device busy Sami Kerola <kerolasa@iki.fi> - 2017-06-24 12:10 +0200
  Re: zram hot_add device busy Minchan Kim <minchan@kernel.org> - 2017-06-26 04:30 +0200
  Re: zram hot_add device busy Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-06-26 04:40 +0200
    Re: zram hot_add device busy Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-06-26 05:00 +0200

csiph-web