Commit cc4c613d authored by Steve Langasek's avatar Steve Langasek
Browse files

mount events now happen so much in parallel that /etc/mtab may not get

updated due to races between 'mounted' events.  Explicitly track the
list of mounts that are in need of fake-remounting and make sure mount -f
gets called for them if they missed the boat. LP: #1060296
parent 9aabdbc0
mountall (2.42) UNRELEASED; urgency=low mountall (2.42) UNRELEASED; urgency=low
[ Andy Whitcroft ]
* Add support for mounting the efivars filesystem onto * Add support for mounting the efivars filesystem onto
/sys/firmware/efi/efivars. LP: #1063061. /sys/firmware/efi/efivars. LP: #1063061.
[ Steve Langasek ]
* mount events now happen so much in parallel that /etc/mtab may not get
updated due to races between 'mounted' events. Explicitly track the
list of mounts that are in need of fake-remounting and make sure mount -f
gets called for them if they missed the boat. LP: #1060296
-- Andy Whitcroft <apw@canonical.com> Tue, 09 Oct 2012 10:12:42 +0100 -- Andy Whitcroft <apw@canonical.com> Tue, 09 Oct 2012 10:12:42 +0100
mountall (2.41) unstable; urgency=low mountall (2.41) unstable; urgency=low
......
...@@ -142,6 +142,7 @@ struct mount { ...@@ -142,6 +142,7 @@ struct mount {
int checked_link; int checked_link;
Mount * link_target; Mount * link_target;
NihList deps; NihList deps;
int needs_mtab;
}; };
#define MOUNT_NAME(_mnt) (strcmp ((_mnt)->type, "swap") \ #define MOUNT_NAME(_mnt) (strcmp ((_mnt)->type, "swap") \
...@@ -506,6 +507,8 @@ new_mount (const char *mountpoint, ...@@ -506,6 +507,8 @@ new_mount (const char *mountpoint,
nih_alloc_set_destructor (mnt, nih_list_destroy); nih_alloc_set_destructor (mnt, nih_list_destroy);
nih_list_add (mounts, &mnt->entry); nih_list_add (mounts, &mnt->entry);
mnt->needs_mtab = FALSE;
update_mount (mnt, device, check, type, opts); update_mount (mnt, device, check, type, opts);
return mnt; return mnt;
...@@ -1927,6 +1930,8 @@ mounted_event_handled (void *data, ...@@ -1927,6 +1930,8 @@ mounted_event_handled (void *data,
if ((! written_mtab)) if ((! written_mtab))
write_mtab (); write_mtab ();
if (written_mtab && mnt->needs_mtab)
run_mount (mnt, TRUE);
switch (mnt->tag) { switch (mnt->tag) {
case TAG_LOCAL: case TAG_LOCAL:
...@@ -2229,6 +2234,7 @@ run_mount (Mount *mnt, ...@@ -2229,6 +2234,7 @@ run_mount (Mount *mnt,
&& strcmp (mnt->type, "ntfs") && strcmp (mnt->type, "ntfs")
&& strcmp (mnt->type, "ntfs-3g")) { && strcmp (mnt->type, "ntfs-3g")) {
NIH_MUST (nih_str_array_add (&args, NULL, &args_len, "-n")); NIH_MUST (nih_str_array_add (&args, NULL, &args_len, "-n"));
mnt->needs_mtab = TRUE;
} else if (mnt->has_showthrough) { } else if (mnt->has_showthrough) {
NIH_MUST (nih_str_array_add (&args, NULL, &args_len, "-n")); NIH_MUST (nih_str_array_add (&args, NULL, &args_len, "-n"));
} }
...@@ -2580,6 +2586,7 @@ write_mtab (void) ...@@ -2580,6 +2586,7 @@ write_mtab (void)
continue; continue;
run_mount (mnt, TRUE); run_mount (mnt, TRUE);
mnt->needs_mtab = FALSE;
} }
written_mtab = TRUE; written_mtab = TRUE;
......
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