[CRIU] [PATCH 1/2] mount: fill fstypes for btrfs mounts on restore
Andrew Vagin
avagin at openvz.org
Thu Apr 17 04:04:00 PDT 2014
BTRFS returns subvolume dev-id instead of superblock dev-id,
so we need to know which mounts are btrfs.
Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
include/fs-magic.h | 4 ++++
mount.c | 13 +++++++++++++
2 files changed, 17 insertions(+)
diff --git a/include/fs-magic.h b/include/fs-magic.h
index 9db3ee9..12bb982 100644
--- a/include/fs-magic.h
+++ b/include/fs-magic.h
@@ -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__ */
diff --git a/mount.c b/mount.c
index 043b2c3..cddaf7f 100644
--- a/mount.c
+++ b/mount.c
@@ -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;
}
--
1.9.0
More information about the CRIU
mailing list