]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
libzfs: Fail making a dataset handle gracefully
authorRyan Moeller <ryan@iXsystems.com>
Fri, 18 Feb 2022 21:09:03 +0000 (16:09 -0500)
committerTony Hutter <hutter2@llnl.gov>
Mon, 6 Jun 2022 23:57:51 +0000 (16:57 -0700)
commit1fdd768d7f5516cee0fca56cd545685e2bdcae12
treed03b09b5f5bded1bac535381f5b0c754f6e3ae7e
parent56eed508d40207d9c45e724cb85d795ba878c575
libzfs: Fail making a dataset handle gracefully

When a dataset is in the process of being received it gets marked as
inconsistent and should not be used.  We should check for this when
opening a dataset handle in libzfs and return with an appropriate error
set, rather than hitting an abort because of the incomplete data.

zfs_open() passes errno to zfs_standard_error() after observing
make_dataset_handle() fail, which ends up aborting if errno is 0.
Set errno before returning where we know it has not been set already.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes #13077
lib/libzfs/libzfs_dataset.c