]> granicus.if.org Git - zfs/commitdiff
Change ASSERT(!"...") to cmn_err(CE_PANIC, ...)
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 27 Feb 2015 20:53:35 +0000 (12:53 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 3 Mar 2015 21:22:21 +0000 (13:22 -0800)
There are a handful of ASSERT(!"...")'s throughout the code base for
cases which should be impossible.  This patch converts them to use
cmn_err(CE_PANIC, ...) to ensure they are always enabled and so that
additional debugging is logged if they were to occur.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #1445

module/zcommon/zfs_deleg.c
module/zfs/arc.c
module/zfs/dmu_tx.c
module/zfs/zap_leaf.c
module/zfs/zap_micro.c

index a152b4e76e0f55399349f280c3394e55fbfc13d2..f6e41da9d7eac1e3cf100e059c1fbd25f6d9893c 100644 (file)
@@ -227,7 +227,7 @@ zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type,
                    ZFS_DELEG_FIELD_SEP_CHR);
                break;
        default:
-               ASSERT(!"bad zfs_deleg_who_type_t");
+               cmn_err(CE_PANIC, "bad zfs_deleg_who_type_t %d", type);
        }
 }
 
index 070d85aafed68ab08dabee6b9f6f474f6525e93a..9a81b4c59944feaa8068b28e6bb15b6554b38ca8 100644 (file)
@@ -2944,7 +2944,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
                DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, buf);
                arc_change_state(arc_mfu, buf, hash_lock);
        } else {
-               ASSERT(!"invalid arc state");
+               cmn_err(CE_PANIC, "invalid arc state 0x%p", buf->b_state);
        }
 }
 
index 890aecc1d2c1e304dc1bd604c0a2c548a4407410..cdf5a6d0fcfafe739ed55f6ba1723a78d90e19d5 100644 (file)
@@ -925,7 +925,8 @@ dmu_tx_dirty_buf(dmu_tx_t *tx, dmu_buf_impl_t *db)
                                match_object = TRUE;
                                break;
                        default:
-                               ASSERT(!"bad txh_type");
+                               cmn_err(CE_PANIC, "bad txh_type %d",
+                                   txh->txh_type);
                        }
                }
                if (match_object && match_offset) {
index 78f05d7a7e37eaf2df7961fb13a608e1c5ab2f2f..9578048250e2f675c30525dc50d492fe58ac8212 100644 (file)
@@ -79,8 +79,9 @@ stv(int len, void *addr, uint64_t value)
        case 8:
                *(uint64_t *)addr = value;
                return;
+       default:
+               cmn_err(CE_PANIC, "bad int len %d", len);
        }
-       ASSERT(!"bad int len");
 }
 
 static uint64_t
@@ -95,8 +96,9 @@ ldv(int len, const void *addr)
                return (*(uint32_t *)addr);
        case 8:
                return (*(uint64_t *)addr);
+       default:
+               cmn_err(CE_PANIC, "bad int len %d", len);
        }
-       ASSERT(!"bad int len");
        return (0xFEEDFACEDEADBEEFULL);
 }
 
@@ -147,7 +149,8 @@ zap_leaf_byteswap(zap_leaf_phys_t *buf, int size)
                        /* la_array doesn't need swapping */
                        break;
                default:
-                       ASSERT(!"bad leaf type");
+                       cmn_err(CE_PANIC, "bad leaf type %d",
+                           lc->l_free.lf_type);
                }
        }
 }
index 0c2e763197720aa013e7cc70737090f06f51ac48..dfa7c661565991c070998ad2fc143d0334d84afc 100644 (file)
@@ -965,7 +965,7 @@ again:
                start = 0;
                goto again;
        }
-       ASSERT(!"out of entries!");
+       cmn_err(CE_PANIC, "out of entries!");
 }
 
 int