[PATCH] zram: Allow backing device to be assigned after init

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

 



There does not appear to be a technical reason to not
allow the zram backing device to be assigned after the
zram device is initialized.

This change will allow for the backing device to be assigned
as long as no backing device is already assigned. In that
event backing_dev would return -EEXIST.

Signed-off-by: Brian Geffon <bgeffon@xxxxxxxxxx>
---
 drivers/block/zram/zram_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index fcaf2750f68f..12b4555ee079 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -462,9 +462,9 @@ static ssize_t backing_dev_store(struct device *dev,
 		return -ENOMEM;
 
 	down_write(&zram->init_lock);
-	if (init_done(zram)) {
-		pr_info("Can't setup backing device for initialized device\n");
-		err = -EBUSY;
+	if (zram->backing_dev) {
+		pr_info("Backing device is already assigned\n");
+		err = -EEXIST;
 		goto out;
 	}
 
-- 
2.33.0.800.g4c38ced690-goog




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux