diff options
author | Sara Hartse <[email protected]> | 2018-05-31 10:36:37 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-05-31 10:36:37 -0700 |
commit | 74d42600d8d391dab5c57e87e81f97e0ca07b7b2 (patch) | |
tree | 8a32fc9cfbcc8a61e5fc0f6e00757dd2adb73b6d /lib/libefi | |
parent | d1f06ec5bccae26639b7bb6bd3925f9998848f86 (diff) |
zpool reopen should detect expanded devices
Update bdev_capacity to have wholedisk vdevs query the
size of the underlying block device (correcting for the size
of the efi parition and partition alignment) and therefore detect
expanded space.
Correct vdev_get_stats_ex so that the expandsize is aligned
to metaslab size and new space is only reported if it is large
enough for a new metaslab.
Reviewed by: Don Brady <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed by: George Wilson <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed by: John Wren Kennedy <[email protected]>
Signed-off-by: sara hartse <[email protected]>
External-issue: LX-165
Closes #7546
Issue #7582
Diffstat (limited to 'lib/libefi')
-rw-r--r-- | lib/libefi/rdwr_efi.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/libefi/rdwr_efi.c b/lib/libefi/rdwr_efi.c index 455fe527d..4b78cc58e 100644 --- a/lib/libefi/rdwr_efi.c +++ b/lib/libefi/rdwr_efi.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2012 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2018 by Delphix. All rights reserved. */ #include <stdio.h> @@ -1154,7 +1155,7 @@ efi_use_whole_disk(int fd) /* * Find the last physically non-zero partition. - * This is the reserved partition. + * This should be the reserved partition. */ for (i = 0; i < efi_label->efi_nparts; i ++) { if (resv_start < efi_label->efi_parts[i].p_start) { @@ -1164,6 +1165,23 @@ efi_use_whole_disk(int fd) } /* + * Verify that we've found the reserved partition by checking + * that it looks the way it did when we created it in zpool_label_disk. + * If we've found the incorrect partition, then we know that this + * device was reformatted and no longer is soley used by ZFS. + */ + if ((efi_label->efi_parts[resv_index].p_size != EFI_MIN_RESV_SIZE) || + (efi_label->efi_parts[resv_index].p_tag != V_RESERVED) || + (resv_index != 8)) { + if (efi_debug) { + (void) fprintf(stderr, + "efi_use_whole_disk: wholedisk not available\n"); + } + efi_free(efi_label); + return (VT_ENOSPC); + } + + /* * Find the last physically non-zero partition before that. * This is the data partition. */ |