"mount -o remount" non-compliant?

Paul Fox pgf at brightstareng.com
Fri Nov 11 13:13:06 UTC 2005


 > Hmmm...  Think think think...  Ok, at first glance the semantics seem 
 > ambiguous, because when you do:
 > 
 > mount -o remount,rw sub
 > 
 > Right now, it's looking for sub in /etc/fstab because we only gave one 
 > non-option argument.  _BUT_, we also said remount, and remount is a special 
 > case.  "This sucker is already mounted."  So in theory we don't care about 
 > fstab (because if we were going to get any info out of it, we already did)...

right.

 > So, special case remount.  Except what if you "-o remount,fred" and the sucker 
 > was previously read only?  Should you have to specify ro again in the -o?  Or 
 > should it look it up out of fstab?  What if fstab says it's read only but you 
 > previously overrode to make it writeable, and then you remount "-o 
 > remount,fred" without specifying ro or rw either way?
 > 
 > Sigh.  I wonder if there's a way to query the current flags from a mount 
 > point?  Yes there is, /proc/mounts fourth field.  Ok, so in theory we grab 
 > that, append the new flags, and let the kernel trim out duplicates?
 > 
 > Boy this is a pain to get right.  But you're correct that we need to 
 > parse /etc/mtab.  Ok...

is remount the only flag this applies to?  i confess i haven't been
keeping track of the ever-growing number of mount options.  in any case,
it really does seem like the code would change very little if you just
substitute the mtab file for /etc/fstab when starting that parse loop.
almost by definition, on a remount you want to use information
that's "current", not information that's "default".

paul
=---------------------
 paul fox, pgf at brightstareng.com



More information about the busybox mailing list