Commit 494c0443 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

mount: dump one file system only once (v2)

A file system can be bind-mounted a few times and some of these mounts
can be non-root. We need to find one of root mounts and dump it.

v2: don't forget to check pm->dumped and pm->parent
    don't dump a root file system, it's always external for now.
Reported-by: 's avatarSaied Kazemi <saied@google.com>
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 69721190
...@@ -117,7 +117,10 @@ struct mount_info { ...@@ -117,7 +117,10 @@ struct mount_info {
struct fstype *fstype; struct fstype *fstype;
char *source; char *source;
char *options; char *options;
bool mounted; union {
bool mounted;
bool dumped;
};
bool need_plugin; bool need_plugin;
int is_file; int is_file;
bool is_ns_root; bool is_ns_root;
......
...@@ -932,8 +932,17 @@ static int dump_one_mountpoint(struct mount_info *pm, int fd) ...@@ -932,8 +932,17 @@ static int dump_one_mountpoint(struct mount_info *pm, int fd)
pm->root, pm->mountpoint); pm->root, pm->mountpoint);
me.fstype = pm->fstype->code; me.fstype = pm->fstype->code;
if (!pm->need_plugin && pm->fstype->dump && pm->fstype->dump(pm))
return -1; if (pm->parent && !pm->dumped && !pm->need_plugin &&
pm->fstype->dump && fsroot_mounted(pm)) {
struct mount_info *t;
if (pm->fstype->dump(pm))
return -1;
list_for_each_entry(t, &pm->mnt_bind, mnt_bind)
t->dumped = true;
}
me.mnt_id = pm->mnt_id; me.mnt_id = pm->mnt_id;
me.root_dev = pm->s_dev; me.root_dev = pm->s_dev;
......
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