grub2/0187-zfs-Fix-disk-matching-logic.patch
Peter Jones 8c6b1ac71e Reconcile with upstream once again.
Also include some minor fixes for gcc 5.1.1

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-07-22 09:46:32 -04:00

69 lines
1.8 KiB
Diff

From 12a9c52e516b94888db0a4502946242e3b14709f Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sat, 24 Jan 2015 20:57:26 +0100
Subject: [PATCH 187/506] zfs: Fix disk-matching logic.
Reported by: Tim Chase <dweeezil>
---
grub-core/fs/zfs/zfs.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
index c943b52..c8c7b97 100644
--- a/grub-core/fs/zfs/zfs.c
+++ b/grub-core/fs/zfs/zfs.c
@@ -252,7 +252,6 @@ struct grub_zfs_data
uberblock_t current_uberblock;
- int mounted;
grub_uint64_t guid;
};
@@ -957,7 +956,7 @@ nvpair_value (const char *nvp,char **val,
static grub_err_t
check_pool_label (struct grub_zfs_data *data,
struct grub_zfs_device_desc *diskdesc,
- int *inserted)
+ int *inserted, int original)
{
grub_uint64_t pool_state, txg = 0;
char *nvlist,*features;
@@ -1081,11 +1080,12 @@ check_pool_label (struct grub_zfs_data *data,
grub_dprintf ("zfs", "check 11 passed\n");
- if (data->mounted && data->guid != poolguid)
- return grub_error (GRUB_ERR_BAD_FS, "another zpool");
- else
+ if (original)
data->guid = poolguid;
+ if (data->guid != poolguid)
+ return grub_error (GRUB_ERR_BAD_FS, "another zpool");
+
{
char *nv;
nv = grub_zfs_nvlist_lookup_nvlist (nvlist, ZPOOL_CONFIG_VDEV_TREE);
@@ -1186,7 +1186,7 @@ scan_disk (grub_device_t dev, struct grub_zfs_data *data,
}
grub_dprintf ("zfs", "label ok %d\n", label);
- err = check_pool_label (data, &desc, inserted);
+ err = check_pool_label (data, &desc, inserted, original);
if (err || !*inserted)
{
grub_errno = GRUB_ERR_NONE;
@@ -3612,8 +3612,6 @@ zfs_mount (grub_device_t dev)
ub_endian) >> 63) & 1;
grub_free (osp);
- data->mounted = 1;
-
return data;
}
--
2.4.3