Commit 779c6762 authored by Stéphane Graber's avatar Stéphane Graber
Browse files

Merge gcc 4.6.2 related bugfix and code to ignor mount points when there's...

Merge gcc 4.6.2 related bugfix and code to ignor mount points when there's already a mounted child from James Hunt's branch
parents 7a1586d5 4b5b4d82
mountall (2.32) UNRELEASED; urgency=low
[ Steve Langasek ]
* Drop /lib/init/rw from /lib/init/fstab, since this is now always a symlink
to /run.
-- Steve Langasek <steve.langasek@ubuntu.com> Fri, 22 Jul 2011 17:37:52 +0200
[ James Hunt ]
* src/mountall.c: mounted(): Add cast to appease gcc 4.6.2.
[ Stéphane Graber ]
* src/mountall.c: mount_policy(): Ignore mount points if there is already a
mounted child (required for lxc(7) to ignore mounts such as /dev).
-- James Hunt <james.hunt@ubuntu.com> Thu, 05 Jan 2012 16:07:12 +0000
mountall (2.31) oneiric; urgency=low
......
......@@ -1027,6 +1027,23 @@ is_remote (Mount *mnt)
void
mount_policy (void)
{
nih_local NihList *already_mounted = NULL;
NihListEntry *entry;
/* Build a list of mountpoints of already mounted
* file systems. Used later to avoid hiding existing
* mounted file systems.
*/
already_mounted = NIH_MUST (nih_list_new (NULL));
NIH_LIST_FOREACH (mounts, iter) {
Mount *mnt = (Mount *)iter;
if (mnt->mountpoint && mnt->mounted) {
entry = NIH_MUST (nih_list_entry_new (already_mounted));
entry->str = NIH_MUST (nih_strdup (entry, mnt->mountpoint));
nih_list_add (already_mounted, &entry->entry);
}
}
NIH_LIST_FOREACH_SAFE (mounts, iter) {
Mount *mnt = (Mount *)iter;
size_t j;
......@@ -1081,6 +1098,23 @@ mount_policy (void)
nih_free (mnt);
continue;
}
/* Check if our current mount entry would hide
* an existing mountpoint. If so, skip it.
*/
NIH_LIST_FOREACH (already_mounted, iter) {
NihListEntry *e = (NihListEntry *)iter;
if (mnt->mountpoint
&& mnt->mountpoint != e->str
&& ! mnt->mounted
&& is_parent (mnt->mountpoint, e->str)) {
nih_debug (
"%s: dropping filesystem because it has an already mounted child (%s)\n",
mnt->mountpoint, e->str);
nih_free (mnt);
break;
}
}
}
NIH_LIST_FOREACH (mounts, iter) {
......@@ -1418,7 +1452,7 @@ mounted (Mount *mnt)
* /dev/root symlink for the right device too ;-)
*/
root = find_mount ("/");
if (root->mounted_dev != -1) {
if (root->mounted_dev != (dev_t)-1) {
FILE *rules;
mask = umask (0022);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment