On Friday 31 October 2008 03:57, Rob Landley wrote: > Ok, when you said "free loop devices", I thought you meant "losetup -d". > You're talking about unmounting loop devices, which is a standard unmounting > problem.
Ok, an example where I don't even mount a loopdevice, but still can't remount my root RO as long as loopdevice eixsts: bash-3.2# mount -o remount,rw / bash-3.2# dd if=/dev/zero bs=1M count=10 >/z 10+0 records in 10+0 records out bash-3.2# mke2fs /z mke2fs 1.34 (25-Jul-2003) /z is not a block special device. Proceed anyway? (y,n) y Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 2560 inodes, 10240 blocks ... bash-3.2# losetup /dev/loop0 /z bash-3.2# mount -o remount,ro / mount: mounting /dev/root on / failed: Device or resource busy > > Looks like robust reboot procedure should try to free all > > loop devices in order to avoid this. Should we patch init here? > > > > /* No inittab file -- set up some default behavior */ > > if (parser == NULL) { > > /* Reboot on Ctrl-Alt-Del */ > > new_init_action(CTRLALTDEL, "reboot", ""); > > /* Umount all filesystems on halt/reboot */ > > new_init_action(SHUTDOWN, "umount -a -r", ""); > > /* Swapoff on halt/reboot */ > > if (ENABLE_SWAPONOFF) > > new_init_action(SHUTDOWN, "swapoff -a", ""); > > There's a umount -a in there already, which was there in busybox 1.2. If the > busybox umount -a isn't unmounting everything properly, that's a separate > bug. What "umount -r -a" should do if remounting RO fails? "losetup -d" every possible loopdevice and retry? > Note that mounts are process context these days, so if you kill all > proccesses > except PID 1, it should naturally reference count those per-process mounts > down to zero and free them, which just leaves the PID 1 mounts that umount -a > should be able to get. In the case we are using per-process mounts, yes, killing processes helps with umount. > Note that if you try to do this from a process _other_ than PID 1, or without > having killed all the other processes on the system, then you're not > guaranteed to have umounted every active filesystem. We do it not from process 1 but from it's children anyway. Not much difference. > See the bit about about some resources being per-processes, so you have to > kill all the processes other than PID 1 in order to make sure the reference > counts of those resources drop to zero and the system can be quiesced? Yes, I have to kill all processes. killall5 does that nicely. -- vda _______________________________________________ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox