Command `mount -a` causing repeated mounts

Michael Abbott michael at araneidae.co.uk
Wed Dec 9 07:54:29 UTC 2009


On Sat, 5 Dec 2009, Denys Vlasenko wrote:
> On Tuesday 01 December 2009 08:51, Michael Abbott wrote:
> > Why does `mount -a` repeatedly mount over mount points that are 
> > already mounted?  Non-busybox mount doesn't appear to do this, and I'm 
> > finding this behaviour to be quite a nuisance.
> Please let me know whether this patch helps.

Sorry I haven't had time to look at this before.  Of course, I'm now 
looking at commit a7329667b4c19fbe8ba077062f14a96038c094db.  This looks 
like exactly what I had in mind.  Didn't know about find_mount_point; I'm 
sure the quadratic search time isn't going to bother us...

I guess util-linux is the reference, and it's disappointing to see that 
util-linux mount doesn't also filter single mounts.  It's a bit nasty to 
see this commented out in our code: presumably we should either implement 
it anyway or remove the code.  (I'm talking about lines 2053 to 2070 of 
util-linux/mount.c, of course.)  I think I'm agnostic either way.

My other thought is that the error message should be filtered on the 
verbose flag, which is what util-linux does.  Here is a patch for that:

diff --git a/util-linux/mount.c b/util-linux/mount.c
index c2b508e..e1372ea 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1999,10 +1999,12 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
                        // "/" may have fsname of "/dev/root" while fstab
                        // says "/dev/something_else".
                        if (mp) {
-                               bb_error_msg("according to %s, "
-                                       "%s is already mounted on %s",
-                                       bb_path_mtab_file,
-                                       mp->mnt_fsname, mp->mnt_dir);
+                               if (verbose) {
+                                       bb_error_msg("according to %s, "
+                                               "%s is already mounted on %s",
+                                               bb_path_mtab_file,
+                                               mp->mnt_fsname, mp->mnt_dir);
+                               }
                        } else {
                                // ...mount this thing
                                if (singlemount(mtcur, /*ignore_busy:*/ 1)) {

Do you have any feeling for when there will be a 1.15.3 release?  Version 
.2 has suddenly acquired a lot of patches!

A note on the patch directory (http://busybox.net/downloads/fixes-1.15.2/). 
There is no way to tell what order the patches need to be applied, perhaps 
there ought to be a sequence number after the version number?  Also, there 
is no description on each patch of what it does: it would really help, if 
nothing else, to add the associated commit message to the patch, or the 
appropriate snippet from the e-mail that generated it.

Of course, mostly the patches don't overlap, so maybe my query about 
sequence number is immaterial.  However another strange note is that every 
time a new patch is added the "Last modified" date updates for all patches 
(to the same date), so it's hard for me to spot which ones are new (and of 
course, if the date was sensible, I could use that for ordering).


More information about the busybox mailing list