freebsd-dev/cddl/contrib/opensolaris
Mark Johnston 4cbba6ae24 MFOpenZFS: Fix zpool history unbounded memory usage
In original implementation, zpool history will read the whole history
before printing anything, causing memory usage goes unbounded. We fix
this by breaking it into read-print iterations.

Reviewed-by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: Matt Ahrens <matt@delphix.com>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes #9516

Note, this change changes the libzfs.so ABI by modifying the prototype
of zpool_get_history().  Since libzfs is effectively private to the base
system it is anticipated that this will not be a problem.

PR:		247557
Obtained from:	OpenZFS
Reported and tested by:	Sam Vaughan <samjvaughan@gmail.com>
Discussed with:	freqlabs
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25745
openzfs/zfs@7125a109dc
2020-07-23 14:21:45 +00:00
..
cmd MFOpenZFS: Fix zpool history unbounded memory usage 2020-07-23 14:21:45 +00:00
common libctf: Don't construct pointers to out of bounds array offsets 2018-03-26 22:02:36 +00:00
head MFV r270197: 2014-08-22 22:13:36 +00:00
lib MFOpenZFS: Fix zpool history unbounded memory usage 2020-07-23 14:21:45 +00:00
tools/ctf Fix a Wvoid-pointer-to-enum-cast warning missed in r359978. 2020-07-06 22:39:42 +00:00
OPENSOLARIS.LICENSE