From: Brian Behlendorf Date: Thu, 26 Aug 2010 17:34:33 +0000 (-0700) Subject: Fix zfs_ioc_objset_stats X-Git-Tag: zfs-0.5.1~53 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a8f5c6b3ca44248b47a4a65515d7828803c71ff;p=zfs Fix zfs_ioc_objset_stats Interestingly this looks like an upstream bug as well. If for some reason we are unable to get a zvols statistics, because perhaps the zpool is hopelessly corrupt, we would trigger the VERIFY. This commit adds the proper error handling just to propagate the error back to user space. Now the user space tools still must handle this properly but in the worst case the tool will crash or perhaps have some missing output. That's far far better than crashing the host. Signed-off-by: Brian Behlendorf --- diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index 4e26cae20..3e149ab33 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -1748,9 +1748,10 @@ zfs_ioc_objset_stats_impl(zfs_cmd_t *zc, objset_t *os) */ if (!zc->zc_objset_stats.dds_inconsistent) { if (dmu_objset_type(os) == DMU_OST_ZVOL) - VERIFY(zvol_get_stats(os, nv) == 0); + error = zvol_get_stats(os, nv); } - error = put_nvlist(zc, nv); + if (error == 0) + error = put_nvlist(zc, nv); nvlist_free(nv); }