From 51a0bb0c2e614659132fce272c8a1815a12c5c2a Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Wed, 27 Oct 2010 19:51:30 -0600 Subject: [PATCH] loop: Properly clear sysfs in autoclear mode In autoclear mode bdev is NULL but the sysfs entry should be destroyed otherwise this warning appears: WARNING: at fs/sysfs/dir.c:451 sysfs_add_one+0x82/0x95() sysfs: cannot create duplicate filename '/devices/virtual/block/loop0/loop' Fixes commit ee86273062cbb310665fe49e1f1937d2cf85b0b9 Signed-off-by: Milan Broz Signed-off-by: Jens Axboe --- drivers/block/loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 450c958b514f..1e5284ef65fa 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1049,9 +1049,9 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev) if (bdev) invalidate_bdev(bdev); set_capacity(lo->lo_disk, 0); + loop_sysfs_exit(lo); if (bdev) { bd_set_size(bdev, 0); - loop_sysfs_exit(lo); /* let user-space know about this change */ kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE); } -- 2.20.1