-
Andrew Morton authored
loop-on-file oopses during unmount. This is because lo_queue is now freed during lo_ioctl(LOOP_CLR_FD). I think the scenario is: 1: umount(8) opens /dev/loop0 2: umount(8) runs lo_ioctl(LOOP_CLR_FD) (this frees the queue) 3: umount(8) closes the /dev/loop0 handle. The blockdev layer syncs the blockdev, but its mapping->backing_dev_info now points into la-la-land. We shouldn't be freeing the queue until all refs to it have gone away. This patch gives the queue the same lifetime as the controlling loop_device itself. It also makes the loop driver's queue appear in sysfs again. It would be better to free the queue when the device is not in use, but I'm not sure how we can hook into the blockdev layer to do that.
534d8695