OS-926: zfs panic in zfs_fill_zplprops_impl()
authorMartin Matuska <mm@FreeBSD.org>
Sun, 8 Apr 2012 17:18:48 +0000 (13:18 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 11 Apr 2012 18:29:19 +0000 (11:29 -0700)
This change appears to be exclusive to SmartOS. It is not present in
illumos-gate but it just adds some needed error handling.  This is
clearly preferable to simply ASSERTING which is what would occur
prior to the patch.

Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Matt Ahrens <matt@delphix.com>
Ported-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #652

module/zfs/zfs_ioctl.c

index 74acc1d..90ebb57 100644 (file)
@@ -20,6 +20,8 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Portions Copyright 2011 Martin Matuska
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  */
 
 #include <sys/types.h>
@@ -2730,6 +2732,7 @@ zfs_fill_zplprops_impl(objset_t *os, uint64_t zplver,
        uint64_t sense = ZFS_PROP_UNDEFINED;
        uint64_t norm = ZFS_PROP_UNDEFINED;
        uint64_t u8 = ZFS_PROP_UNDEFINED;
+       int error;
 
        ASSERT(zplprops != NULL);
 
@@ -2773,8 +2776,9 @@ zfs_fill_zplprops_impl(objset_t *os, uint64_t zplver,
        VERIFY(nvlist_add_uint64(zplprops,
            zfs_prop_to_name(ZFS_PROP_VERSION), zplver) == 0);
 
-       if (norm == ZFS_PROP_UNDEFINED)
-               VERIFY(zfs_get_zplprop(os, ZFS_PROP_NORMALIZE, &norm) == 0);
+       if (norm == ZFS_PROP_UNDEFINED &&
+           (error = zfs_get_zplprop(os, ZFS_PROP_NORMALIZE, &norm)) != 0)
+               return (error);
        VERIFY(nvlist_add_uint64(zplprops,
            zfs_prop_to_name(ZFS_PROP_NORMALIZE), norm) == 0);
 
@@ -2783,13 +2787,15 @@ zfs_fill_zplprops_impl(objset_t *os, uint64_t zplver,
         */
        if (norm)
                u8 = 1;
-       if (u8 == ZFS_PROP_UNDEFINED)
-               VERIFY(zfs_get_zplprop(os, ZFS_PROP_UTF8ONLY, &u8) == 0);
+       if (u8 == ZFS_PROP_UNDEFINED &&
+           (error = zfs_get_zplprop(os, ZFS_PROP_UTF8ONLY, &u8)) != 0)
+               return (error);
        VERIFY(nvlist_add_uint64(zplprops,
            zfs_prop_to_name(ZFS_PROP_UTF8ONLY), u8) == 0);
 
-       if (sense == ZFS_PROP_UNDEFINED)
-               VERIFY(zfs_get_zplprop(os, ZFS_PROP_CASE, &sense) == 0);
+       if (sense == ZFS_PROP_UNDEFINED &&
+           (error = zfs_get_zplprop(os, ZFS_PROP_CASE, &sense)) != 0)
+               return (error);
        VERIFY(nvlist_add_uint64(zplprops,
            zfs_prop_to_name(ZFS_PROP_CASE), sense) == 0);