]> Git Repo - linux.git/commitdiff
null_blk: Fix: memory release when memory_backed=1
authorNitesh Shetty <[email protected]>
Mon, 5 Jun 2023 06:23:53 +0000 (11:53 +0530)
committerJens Axboe <[email protected]>
Mon, 5 Jun 2023 22:15:35 +0000 (16:15 -0600)
Memory/pages are not freed, when unloading nullblk driver.

Steps to reproduce issue
  1.free -h
        total        used        free      shared  buff/cache   available
Mem:    7.8Gi       260Mi       7.1Gi       3.0Mi       395Mi       7.3Gi
Swap:      0B          0B          0B
  2.modprobe null_blk memory_backed=1
  3.dd if=/dev/urandom of=/dev/nullb0 oflag=direct bs=1M count=1000
  4.modprobe -r null_blk
  5.free -h
        total        used        free      shared  buff/cache   available
Mem:    7.8Gi       1.2Gi       6.1Gi       3.0Mi       398Mi       6.3Gi
Swap:      0B          0B          0B

Signed-off-by: Anuj Gupta <[email protected]>
Signed-off-by: Nitesh Shetty <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
drivers/block/null_blk/main.c

index b3fedafe301e837206d6a0c2a22f40231dc3aeb5..864013019d6b6508d8750c7f19c10a11b710e9ca 100644 (file)
@@ -2244,6 +2244,7 @@ static void null_destroy_dev(struct nullb *nullb)
        struct nullb_device *dev = nullb->dev;
 
        null_del_dev(nullb);
+       null_free_device_storage(dev, false);
        null_free_dev(dev);
 }
 
This page took 0.060894 seconds and 4 git commands to generate.