Merge lp:~jamesodhunt/ubuntu/precise/mountall/ignore-already-mounted-mounts into lp:ubuntu/precise/mountall

Proposed by James Hunt
Status: Merged
Merged at revision: 375
Proposed branch: lp:~jamesodhunt/ubuntu/precise/mountall/ignore-already-mounted-mounts
Merge into: lp:ubuntu/precise/mountall
Diff against target: 83 lines (+44/-2)
2 files modified
debian/changelog (+9/-1)
src/mountall.c (+35/-1)
To merge this branch: bzr merge lp:~jamesodhunt/ubuntu/precise/mountall/ignore-already-mounted-mounts
Reviewer Review Type Date Requested Status
Stéphane Graber Pending
Review via email: mp+87645@code.launchpad.net

Description of the change

[ 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).

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2011-07-22 15:38:16 +0000
+++ debian/changelog 2012-01-05 16:12:27 +0000
@@ -1,9 +1,17 @@
1mountall (2.32) UNRELEASED; urgency=low1mountall (2.32) UNRELEASED; urgency=low
22
3 [ Steve Langasek ]
3 * Drop /lib/init/rw from /lib/init/fstab, since this is now always a symlink4 * Drop /lib/init/rw from /lib/init/fstab, since this is now always a symlink
4 to /run.5 to /run.
56
6 -- Steve Langasek <steve.langasek@ubuntu.com> Fri, 22 Jul 2011 17:37:52 +02007 [ James Hunt ]
8 * src/mountall.c: mounted(): Add cast to appease gcc 4.6.2.
9
10 [ Stéphane Graber ]
11 * src/mountall.c: mount_policy(): Ignore mount points if there is already a
12 mounted child (required for lxc(7) to ignore mounts such as /dev).
13
14 -- James Hunt <james.hunt@ubuntu.com> Thu, 05 Jan 2012 16:07:12 +0000
715
8mountall (2.31) oneiric; urgency=low16mountall (2.31) oneiric; urgency=low
917
1018
=== modified file 'src/mountall.c'
--- src/mountall.c 2011-07-15 12:30:49 +0000
+++ src/mountall.c 2012-01-05 16:12:27 +0000
@@ -1027,6 +1027,23 @@
1027void1027void
1028mount_policy (void)1028mount_policy (void)
1029{1029{
1030 nih_local NihList *already_mounted = NULL;
1031 NihListEntry *entry;
1032
1033 /* Build a list of mountpoints of already mounted
1034 * file systems. Used later to avoid hiding existing
1035 * mounted file systems.
1036 */
1037 already_mounted = NIH_MUST (nih_list_new (NULL));
1038 NIH_LIST_FOREACH (mounts, iter) {
1039 Mount *mnt = (Mount *)iter;
1040 if (mnt->mountpoint && mnt->mounted) {
1041 entry = NIH_MUST (nih_list_entry_new (already_mounted));
1042 entry->str = NIH_MUST (nih_strdup (entry, mnt->mountpoint));
1043 nih_list_add (already_mounted, &entry->entry);
1044 }
1045 }
1046
1030 NIH_LIST_FOREACH_SAFE (mounts, iter) {1047 NIH_LIST_FOREACH_SAFE (mounts, iter) {
1031 Mount *mnt = (Mount *)iter;1048 Mount *mnt = (Mount *)iter;
1032 size_t j;1049 size_t j;
@@ -1081,6 +1098,23 @@
1081 nih_free (mnt);1098 nih_free (mnt);
1082 continue;1099 continue;
1083 }1100 }
1101
1102 /* Check if our current mount entry would hide
1103 * an existing mountpoint. If so, skip it.
1104 */
1105 NIH_LIST_FOREACH (already_mounted, iter) {
1106 NihListEntry *e = (NihListEntry *)iter;
1107 if (mnt->mountpoint
1108 && mnt->mountpoint != e->str
1109 && ! mnt->mounted
1110 && is_parent (mnt->mountpoint, e->str)) {
1111 nih_debug (
1112 "%s: dropping filesystem because it has an already mounted child (%s)\n",
1113 mnt->mountpoint, e->str);
1114 nih_free (mnt);
1115 break;
1116 }
1117 }
1084 }1118 }
10851119
1086 NIH_LIST_FOREACH (mounts, iter) {1120 NIH_LIST_FOREACH (mounts, iter) {
@@ -1418,7 +1452,7 @@
1418 * /dev/root symlink for the right device too ;-)1452 * /dev/root symlink for the right device too ;-)
1419 */1453 */
1420 root = find_mount ("/");1454 root = find_mount ("/");
1421 if (root->mounted_dev != -1) {1455 if (root->mounted_dev != (dev_t)-1) {
1422 FILE *rules;1456 FILE *rules;
14231457
1424 mask = umask (0022);1458 mask = umask (0022);

Subscribers

People subscribed via source and target branches

to all changes: