The patch titled Subject: zram: allow backing device to be assigned after init has been added to the -mm tree. Its filename is zram-allow-backing-device-to-be-assigned-after-init.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/zram-allow-backing-device-to-be-assigned-after-init.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/zram-allow-backing-device-to-be-assigned-after-init.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Brian Geffon <bgeffon@xxxxxxxxxx> Subject: zram: allow backing device to be assigned after init 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. Link: https://lkml.kernel.org/r/20211001181627.394921-1-bgeffon@xxxxxxxxxx Signed-off-by: Brian Geffon <bgeffon@xxxxxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Nitin Gupta <ngupta@xxxxxxxxxx> Cc: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Cc: Suleiman Souhlal <suleiman@xxxxxxxxxx> Cc: Jesse Barnes <jsbarnes@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/block/zram/zram_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/block/zram/zram_drv.c~zram-allow-backing-device-to-be-assigned-after-init +++ a/drivers/block/zram/zram_drv.c @@ -492,9 +492,9 @@ static ssize_t backing_dev_store(struct 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; } _ Patches currently in -mm which might be from bgeffon@xxxxxxxxxx are zram-introduce-an-aged-idle-interface.patch zram-introduce-an-aged-idle-interface-v5.patch zram-introduce-an-aged-idle-interface-v6.patch zram-allow-backing-device-to-be-assigned-after-init.patch