Re: zram hot_add device busy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux