Commit a1d7c7c5 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

mount: Dump/restore devtmpfs if it's virtualized

In case if we meet virtualized devtmpfs on dump
(which means its s_dev is different from one obtained
 during mountpoints dump procedure) we should dump it
with tar help. Thus on restore it get filled from the
image.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 48d81eb4
......@@ -737,6 +737,26 @@ out:
return ret;
}
static bool rt_detmpfs_match(struct mount_info *pm)
{
struct stat *host_st;
host_st = kerndat_get_fs_stat(KERNDAT_FS_STAT_DEVTMPFS);
if (host_st) {
if (host_st->st_dev == kdev_to_odev(pm->s_dev))
return true;
}
return false;
}
static int devtmpfs_dump(struct mount_info *pm)
{
if (!rt_detmpfs_match(pm))
return tmpfs_dump(pm);
return 0;
}
static int tmpfs_restore(struct mount_info *pm)
{
int ret;
......@@ -761,6 +781,13 @@ static int tmpfs_restore(struct mount_info *pm)
return 0;
}
static int devtmpfs_restore(struct mount_info *pm)
{
if (!rt_detmpfs_match(pm))
return tmpfs_restore(pm);
return 0;
}
static int binfmt_misc_dump(struct mount_info *pm)
{
int fd, ret = -1;
......@@ -839,6 +866,8 @@ static struct fstype fstypes[] = {
}, {
.name = "devtmpfs",
.code = FSTYPE__DEVTMPFS,
.dump = devtmpfs_dump,
.restore = devtmpfs_restore,
}, {
.name = "binfmt_misc",
.code = FSTYPE__BINFMT_MISC,
......
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