[BusyBox] My mount rewrite.

Rob Landley rob at landley.net
Tue Feb 8 06:18:01 UTC 2005


Okay, it builds again, and seems to work.  It needs one more cleanup pass, but 
here it is in case anybody wants to point and laugh in the meantime.

Lots of notes about it.  loop.o and mount.o are both smaller, still need to 
wave nm at the thing to see if there's an actual size improvement.  But the 
code's been simplified a bit, and several other things fixed.

Let's see: you no longer need to say "-o loop" (although you can, but it's 
ignored if you do).  It'll just figure out whether or not it needs to use it 
depending on whether you try to mount a file or a device.  (Why this wasn't 
done years ago, I dunno.)

There's also a problem with the conventional mount command (not just busybox, 
but util-linux too) that if you have a writeable "blah.img" file and you loop 
mount it in two locations, you get two writeable mounts of the same 
filesystem that the kernel doesn't know are shared.  (It gets bound to two 
different loop devices, and you get a corrupted filesystem.)  With the new 
code, it detects existing loop devices that are already bound to the sucker, 
and re-uses those if it can, so it works like a bind mount instead and 
doesn't corrupt the loopback mounted filesystem.  (Yes, there are potential 
races here.  But there's always races allocating and freeing loop devices.  
And no, it's not reliable in that if there's a free loop device before the 
one already bound to this file, it'll stop at the free one and allocate that.  
If you care about this stuff, use losetup, or bug me to try to add more retry 
logic.)

And of course the bug that triggered all this: if your kernel hasn't got any 
block device backed filesystems in it and you try to do a --bind or --move 
mount, it should now work.

Oh yeah, and it should now accept --bind and --move syntax (and for that 
matter --remount and any other thing you could pass with -o).

There's other stuff, but I'm tired.  I'll attach a properly clean patch to the 
debug system thingy later on (unless eric wants to actually get subversion 
working...) 

Rob

P.S.  Remind me to attach the history stuff I removed from the top of mount.c 
to the CVS/subversion checkin comment.  That's where that sort of thing 
belongs, isn't it?  The CVS comments?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: mount.patch
Type: text/x-diff
Size: 35500 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20050208/ea41e957/attachment.bin 


More information about the busybox mailing list