Commit b664bb14 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

mount: fill fstypes for btrfs mounts on restore

BTRFS returns subvolume dev-id instead of superblock dev-id,
so we need to know which mounts are btrfs.

The mi->fstype->name is "unsuppoerted" here, because the fstype->code
is saved in an image

{
.name = "unsupported",
.code = FSTYPE__UNSUPPORTED,
},
{
.name = "btrfs",
.code = FSTYPE__UNSUPPORTED,
}

An a second reason is that pocesses can be migrated from smth to btrfs.
This all can happen _only_ for the root mount and for bind mounts of
the root mount...
Signed-off-by: 's avatarAndrew Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e01dc7fa
......@@ -33,4 +33,8 @@
#define DEVPTS_SUPER_MAGIC 0x1cd1
#endif
#ifndef BTRFS_SUPER_MAGIC
#define BTRFS_SUPER_MAGIC 0x9123683E
#endif
#endif /* __CR_FS_MAGIC_H__ */
......@@ -25,6 +25,8 @@
#include "namespaces.h"
#include "protobuf.h"
#include "kerndat.h"
#include "fs-magic.h"
#include "protobuf/mnt.pb-c.h"
/*
......@@ -1230,6 +1232,17 @@ static int do_mount_one(struct mount_info *mi)
if (ret == 0 && propagate_mount(mi))
return -1;
if (mi->fstype->code == FSTYPE__UNSUPPORTED) {
struct statfs st;
if (statfs(mi->mountpoint, &st)) {
pr_perror("Unable to statfs %s", mi->mountpoint);
return -1;
}
if (st.f_type == BTRFS_SUPER_MAGIC)
mi->fstype = find_fstype_by_name("btrfs");
}
return ret;
}
......
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