From 89f0abf9b5f26eb87b9ef12e3b72b436658bec07 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 6 Aug 2010 10:46:39 -0700 Subject: [PATCH 1/2] Add missing zfs_ioc_objset_stats() error handling 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. Closes #45 --- .topdeps | 1 + .topmsg | 12 ++++++++++++ module/zfs/zfs_ioctl.c | 5 +++-- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .topdeps create mode 100644 .topmsg diff --git a/.topdeps b/.topdeps new file mode 100644 index 0000000000..1f7391f92b --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +master diff --git a/.topmsg b/.topmsg new file mode 100644 index 0000000000..d97be26343 --- /dev/null +++ b/.topmsg @@ -0,0 +1,12 @@ +From: Brian Behlendorf +Subject: [PATCH] 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 de5fb1e4ce..2bad213210 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -1611,9 +1611,10 @@ zfs_ioc_objset_stats(zfs_cmd_t *zc) */ 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); } From 46e9b0989d3f92dc0f1fc2ee93f0132bd159128c Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 6 Aug 2010 10:46:58 -0700 Subject: [PATCH 2/2] New TopGit dependency: fix-zfs_ioc_objset_stats --- .topdeps | 1 + 1 file changed, 1 insertion(+) diff --git a/.topdeps b/.topdeps index 26901127fd..24146e7fc9 100644 --- a/.topdeps +++ b/.topdeps @@ -29,3 +29,4 @@ fix-stack-zio_done fix-stack-dsl_scan_visitbp fix-stack-dbuf_hold_impl fix-bpobj_close +fix-zfs_ioc_objset_stats