grub2/0095-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch
Javier Martinez Canillas 1f092caba7
Drop two efinet patches that were causing issues and a bunch of other fixes
Add comments and revert logic changes in 01_fallback_counting
Remove quotes when reading ID value from /etc/os-release
  Related: rhbz#1650706
blscfg: expand grub_users before passing to grub_normal_add_menu_entry()
  Resolves: rhbz#1650706
Drop buggy downstream patch "efinet: retransmit if our device is busy"
  Resolves: rhbz#1649048
Make the menu entry users option argument to be optional
  Related: rhbz#1652434
10_linux_bls: add missing menu entries options
  Resolves: rhbz#1652434
Drop "Be more aggro about actually using the *configured* network device."
  Resolves: rhbz#1654388
Fix menu entry selection based on title
  Resolves: rhbz#1654936

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-12-01 03:28:36 +01:00

59 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
Date: Tue, 21 Jun 2016 16:44:17 +0000
Subject: [PATCH] Fallback to old subvol name scheme to support old 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
index 2e36ac47e8a..4a31d39ee74 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -924,11 +924,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
return GRUB_ERR_NONE;
}
+static grub_err_t
+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;
+}
+
static grub_err_t
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);