forked from Minki/linux
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 ee86273062
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
This commit is contained in:
parent
12ba8d1e92
commit
51a0bb0c2e
@ -1049,9 +1049,9 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
|
|||||||
if (bdev)
|
if (bdev)
|
||||||
invalidate_bdev(bdev);
|
invalidate_bdev(bdev);
|
||||||
set_capacity(lo->lo_disk, 0);
|
set_capacity(lo->lo_disk, 0);
|
||||||
|
loop_sysfs_exit(lo);
|
||||||
if (bdev) {
|
if (bdev) {
|
||||||
bd_set_size(bdev, 0);
|
bd_set_size(bdev, 0);
|
||||||
loop_sysfs_exit(lo);
|
|
||||||
/* let user-space know about this change */
|
/* let user-space know about this change */
|
||||||
kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
|
kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user