]> git.hungrycats.org Git - linux/commit
[PATCH] loop oops fix
authorAndrew Morton <akpm@osdl.org>
Thu, 14 Aug 2003 17:22:37 +0000 (10:22 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Thu, 14 Aug 2003 17:22:37 +0000 (10:22 -0700)
commit534d8695489543a6434c00d32f9698e3061659f5
tree431679fd8f105e26b712aab735f9f81d9784c6a6
parent2afe8ba33a05a217f2d7a8aa608680436f2598c6
[PATCH] loop oops fix

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.
drivers/block/loop.c