Skip to content

Commit

Permalink
Add missing zfs_ioc_objset_stats() error handling
Browse files Browse the repository at this point in the history
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
  • Loading branch information
behlendorf committed Aug 6, 2010
1 parent b3c82b1 commit 89f0abf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions .topdeps
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
master
12 changes: 12 additions & 0 deletions .topmsg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
From: Brian Behlendorf <behlendorf1@llnl.gov>
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 <behlendorf1@llnl.gov>
5 changes: 3 additions & 2 deletions module/zfs/zfs_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 89f0abf

Please sign in to comment.