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
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-07-22 15:38:16 +0000
3+++ debian/changelog 2012-01-05 16:12:27 +0000
4@@ -1,9 +1,17 @@
5 mountall (2.32) UNRELEASED; urgency=low
6
7+ [ Steve Langasek ]
8 * Drop /lib/init/rw from /lib/init/fstab, since this is now always a symlink
9 to /run.
10
11- -- Steve Langasek <steve.langasek@ubuntu.com> Fri, 22 Jul 2011 17:37:52 +0200
12+ [ James Hunt ]
13+ * src/mountall.c: mounted(): Add cast to appease gcc 4.6.2.
14+
15+ [ Stéphane Graber ]
16+ * src/mountall.c: mount_policy(): Ignore mount points if there is already a
17+ mounted child (required for lxc(7) to ignore mounts such as /dev).
18+
19+ -- James Hunt <james.hunt@ubuntu.com> Thu, 05 Jan 2012 16:07:12 +0000
20
21 mountall (2.31) oneiric; urgency=low
22
23
24=== modified file 'src/mountall.c'
25--- src/mountall.c 2011-07-15 12:30:49 +0000
26+++ src/mountall.c 2012-01-05 16:12:27 +0000
27@@ -1027,6 +1027,23 @@
28 void
29 mount_policy (void)
30 {
31+ nih_local NihList *already_mounted = NULL;
32+ NihListEntry *entry;
33+
34+ /* Build a list of mountpoints of already mounted
35+ * file systems. Used later to avoid hiding existing
36+ * mounted file systems.
37+ */
38+ already_mounted = NIH_MUST (nih_list_new (NULL));
39+ NIH_LIST_FOREACH (mounts, iter) {
40+ Mount *mnt = (Mount *)iter;
41+ if (mnt->mountpoint && mnt->mounted) {
42+ entry = NIH_MUST (nih_list_entry_new (already_mounted));
43+ entry->str = NIH_MUST (nih_strdup (entry, mnt->mountpoint));
44+ nih_list_add (already_mounted, &entry->entry);
45+ }
46+ }
47+
48 NIH_LIST_FOREACH_SAFE (mounts, iter) {
49 Mount *mnt = (Mount *)iter;
50 size_t j;
51@@ -1081,6 +1098,23 @@
52 nih_free (mnt);
53 continue;
54 }
55+
56+ /* Check if our current mount entry would hide
57+ * an existing mountpoint. If so, skip it.
58+ */
59+ NIH_LIST_FOREACH (already_mounted, iter) {
60+ NihListEntry *e = (NihListEntry *)iter;
61+ if (mnt->mountpoint
62+ && mnt->mountpoint != e->str
63+ && ! mnt->mounted
64+ && is_parent (mnt->mountpoint, e->str)) {
65+ nih_debug (
66+ "%s: dropping filesystem because it has an already mounted child (%s)\n",
67+ mnt->mountpoint, e->str);
68+ nih_free (mnt);
69+ break;
70+ }
71+ }
72 }
73
74 NIH_LIST_FOREACH (mounts, iter) {
75@@ -1418,7 +1452,7 @@
76 * /dev/root symlink for the right device too ;-)
77 */
78 root = find_mount ("/");
79- if (root->mounted_dev != -1) {
80+ if (root->mounted_dev != (dev_t)-1) {
81 FILE *rules;
82
83 mask = umask (0022);

Subscribers

People subscribed via source and target branches

to all changes: