freebsd-dev/cddl/contrib/opensolaris/cmd
Toomas Soome 722c2b4aca MFOpenZFS: Add support for boot environment data to be stored in the label
We are building new bootonce mechanism (previously zfs bootnext) and it is
based on this OpenZFS change. Since this patch is nicely self contained,
I am commiting it as is, and we can stack our changes.

Original patch description follows:

Modern bootloaders leverage data stored in the root filesystem to
enable some of their powerful features. GRUB specifically has a grubenv
file which can store large amounts of configuration data that can be
read and written at boot time and during normal operation. This allows
sysadmins to configure useful features like automated failover after
failed boot attempts. Unfortunately, due to the Copy-on-Write nature
of ZFS, the standard behavior of these tools cannot handle writing to
ZFS files safely at boot time. We need an alternative way to store
data that allows the bootloader to make changes to the data.

This work is very similar to work that was done on Illumos to enable
similar functionality in the FreeBSD bootloader. This patch is different
in that the data being stored is a raw grubenv file; this file can store
arbitrary variables and values, and the scripting provided by grub is
powerful enough that special structures are not required to implement
advanced behavior.

We repurpose the second padding area in each label to store the grubenv
file, protected by an embedded checksum. We add two ioctls to get and
set this data, and libzfs_core and libzfs functions to access them more
easily. There are no direct command line interfaces to these functions;
these will be added directly to the bootloader utilities.

Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #10009

Obtained from:	OpenZFS
Sponsored by:	Netflix, Klara Inc.
2020-08-05 14:32:20 +00:00
..
dtrace Add HISTORY sections to ZFS and dtrace manpage 2020-06-14 05:50:28 +00:00
lockstat Add HISTORY sections to ZFS and dtrace manpage 2020-06-14 05:50:28 +00:00
mdb/tools/common Mechanically convert cddl sun #ifdef's to illumos 2015-01-17 14:44:59 +00:00
plockstat Fix the build for non-amd64. 2015-12-02 02:11:38 +00:00
pyzfs
stat/common
zdb Add HISTORY sections to ZFS and dtrace manpage 2020-06-14 05:50:28 +00:00
zfs MFOpenZFS: Add basic zfs ioc input nvpair validation 2020-06-23 06:42:39 +00:00
zhack MFV r354378,r354379,r354386: 10499 Multi-modifier protection (MMP) 2019-11-18 09:38:35 +00:00
zinject MFOpenZFS: Add support for boot environment data to be stored in the label 2020-08-05 14:32:20 +00:00
zlook
zpool MFOpenZFS: Fix zpool history unbounded memory usage 2020-07-23 14:21:45 +00:00
zstreamdump Add HISTORY sections to ZFS and dtrace manpage 2020-06-14 05:50:28 +00:00
ztest MFOpenZFS: make zil max block size tunable 2020-03-19 01:05:54 +00:00