summaryrefslogtreecommitdiffstats
path: root/libmount
diff options
context:
space:
mode:
authorKarel Zak2015-02-16 12:49:49 +0100
committerKarel Zak2015-02-16 12:49:49 +0100
commite3f72275ca2fa65b51f8183af925a5541eed8a7a (patch)
treedbfe8f5897acd554fe8560183f535b36aa21276a /libmount
parenthwclock: man-page errata (diff)
downloadkernel-qcow2-util-linux-e3f72275ca2fa65b51f8183af925a5541eed8a7a.tar.gz
kernel-qcow2-util-linux-e3f72275ca2fa65b51f8183af925a5541eed8a7a.tar.xz
kernel-qcow2-util-linux-e3f72275ca2fa65b51f8183af925a5541eed8a7a.zip
libmount: add --enable-libmount-force-mountinfo
The default libmount mtab management depends on mtan symlink. If the symlink exists than libmount parses /proc/self/mountinfo, otherwise it parses regular classic /etc/mtab. This is backwardly compatible and transparent solution. Unfortunately, this is not robust enough because some broken init scripts or 3-party mount helpers may remove the symlink and create regular mtab file. This is pretty bad if initd (systemd) depends on libmount. Fortunately we known that mtab is absolutely unwanted on some distros, so it's fine too ignore mtab at all and don't care about the symlink. Reported-by: Martin Pitt <martin.pitt@ubuntu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount')
-rw-r--r--libmount/src/context.c4
-rw-r--r--libmount/src/tab_parse.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/libmount/src/context.c b/libmount/src/context.c
index c902f396e..0fb9f6f80 100644
--- a/libmount/src/context.c
+++ b/libmount/src/context.c
@@ -219,7 +219,11 @@ static int context_init_paths(struct libmnt_context *cxt, int writable)
DBG(CXT, ul_debugobj(cxt, "checking for writable tab files"));
+#ifdef USE_LIBMOUNT_FORCE_MOUNTINFO
+ cxt->mtab_writable = 0;
+#else
mnt_has_regular_mtab(&cxt->mtab_path, &cxt->mtab_writable);
+#endif
if (!cxt->mtab_writable)
/* use /run/mount/utab if /etc/mtab is useless */
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
index 2757d0fee..0f87730ee 100644
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -1052,6 +1052,9 @@ int __mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename,
assert(tb);
+#ifdef USE_LIBMOUNT_FORCE_MOUNTINFO
+ DBG(TAB, ul_debugobj(tb, "mtab parse: ignore %s", filename ? filename : "mtab"));
+#else
if (mnt_has_regular_mtab(&filename, NULL)) {
DBG(TAB, ul_debugobj(tb, "force mtab usage [filename=%s]", filename));
@@ -1069,7 +1072,7 @@ int __mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename,
return 0;
filename = NULL; /* failed */
}
-
+#endif
DBG(TAB, ul_debugobj(tb, "mtab parse: #1 read mountinfo"));
/*