zfs: Fix disk-matching logic.

Reported by: Tim Chase <dweeezil>
This commit is contained in:
Vladimir Serbinenko 2015-01-24 20:57:26 +01:00
parent 68cf24376c
commit 12a9c52e51

View file

@ -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;
}