2018-04-11 18:42:03 +00:00
|
|
|
From ab8e0d4bf544b708f5afa4cc56e6bd16789f2f1e Mon Sep 17 00:00:00 2001
|
2017-06-16 19:31:32 +00:00
|
|
|
From: Andrei Borzenkov <arvidjaar@gmail.com>
|
|
|
|
Date: Tue, 21 Jun 2016 16:44:17 +0000
|
2018-04-11 18:42:03 +00:00
|
|
|
Subject: [PATCH 180/229] Fallback to old subvol name scheme to support old
|
2017-06-16 19:31:32 +00:00
|
|
|
snapshot config
|
|
|
|
|
|
|
|
Ref: bsc#953538
|
|
|
|
---
|
|
|
|
grub-core/fs/btrfs.c | 32 +++++++++++++++++++++++++++++++-
|
|
|
|
1 file changed, 31 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
|
2018-02-27 18:56:41 +00:00
|
|
|
index d111147e836..a5c000805a7 100644
|
2017-06-16 19:31:32 +00:00
|
|
|
--- a/grub-core/fs/btrfs.c
|
|
|
|
+++ b/grub-core/fs/btrfs.c
|
2018-01-17 20:40:19 +00:00
|
|
|
@@ -924,11 +924,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
|
|
|
|
return GRUB_ERR_NONE;
|
2017-06-16 19:31:32 +00:00
|
|
|
}
|
|
|
|
|
2018-01-17 20:40:19 +00:00
|
|
|
+static grub_err_t
|
2017-06-16 19:31:32 +00:00
|
|
|
+lookup_root_by_name_fallback(struct grub_btrfs_data *data, const char *path)
|
|
|
|
+{
|
|
|
|
+ grub_err_t err;
|
|
|
|
+ grub_uint64_t tree = 0;
|
|
|
|
+ grub_uint8_t type;
|
|
|
|
+ struct grub_btrfs_key key;
|
|
|
|
+
|
|
|
|
+ err = find_path (data, path, &key, &tree, &type);
|
|
|
|
+ if (err)
|
|
|
|
+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path);
|
|
|
|
+
|
|
|
|
+ if (key.object_id != grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK) || tree == 0)
|
|
|
|
+ return grub_error(GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", path);
|
|
|
|
+
|
|
|
|
+ data->fs_tree = tree;
|
|
|
|
+ return GRUB_ERR_NONE;
|
|
|
|
+}
|
|
|
|
+
|
2018-01-17 20:40:19 +00:00
|
|
|
static grub_err_t
|
2017-06-16 19:31:32 +00:00
|
|
|
btrfs_handle_subvol(struct grub_btrfs_data *data __attribute__ ((unused)))
|
|
|
|
{
|
|
|
|
if (btrfs_default_subvol)
|
|
|
|
- return lookup_root_by_name(data, btrfs_default_subvol);
|
|
|
|
+ {
|
|
|
|
+ grub_err_t err;
|
|
|
|
+ err = lookup_root_by_name(data, btrfs_default_subvol);
|
|
|
|
+
|
|
|
|
+ /* Fallback to old schemes */
|
|
|
|
+ if (err == GRUB_ERR_FILE_NOT_FOUND)
|
|
|
|
+ {
|
|
|
|
+ err = GRUB_ERR_NONE;
|
|
|
|
+ return lookup_root_by_name_fallback(data, btrfs_default_subvol);
|
|
|
|
+ }
|
|
|
|
+ return err;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (btrfs_default_subvolid)
|
|
|
|
return lookup_root_by_id(data, btrfs_default_subvolid);
|
|
|
|
--
|
2018-02-27 18:56:41 +00:00
|
|
|
2.15.0
|
2017-06-16 19:31:32 +00:00
|
|
|
|