Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs Sprinkle some mor...



details:   https://anonhg.NetBSD.org/src/rev/a268408d3516
branches:  trunk
changeset: 814014:a268408d3516
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Feb 29 16:18:37 2016 +0000

description:
Sprinkle some more zfs range lock reference count kasserts.

>From a debugging session months ago, might as well share them.

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (65 lines):

diff -r 0912d99e06b6 -r a268408d3516 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c    Mon Feb 29 16:16:42 2016 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c    Mon Feb 29 16:18:37 2016 +0000
@@ -98,6 +98,8 @@
 zfs_range_lock_hold(rl_t *rl)
 {
 
+       KASSERT(rl->r_zp != NULL);
+       KASSERT(0 < rl->r_refcnt);
        KASSERT(mutex_owned(&rl->r_zp->z_range_lock));
 
        if (rl->r_refcnt >= ULONG_MAX)
@@ -111,8 +113,9 @@
 zfs_range_lock_rele(rl_t *rl)
 {
 
+       KASSERT(rl->r_zp != NULL);
+       KASSERT(0 < rl->r_refcnt);
        KASSERT(mutex_owned(&rl->r_zp->z_range_lock));
-       KASSERT(rl->r_refcnt > 0);
 
        if (--rl->r_refcnt == 0) {
                cv_destroy(&rl->r_wr_cv);
@@ -184,10 +187,12 @@
                        goto wait; /* already locked at same offset */
 
                rl = (rl_t *)avl_nearest(tree, where, AVL_AFTER);
+               KASSERT(0 < rl->r_refcnt);
                if (rl && (rl->r_off < new->r_off + new->r_len))
                        goto wait;
 
                rl = (rl_t *)avl_nearest(tree, where, AVL_BEFORE);
+               KASSERT(0 < rl->r_refcnt);
                if (rl && rl->r_off + rl->r_len > new->r_off)
                        goto wait;
 
@@ -345,6 +350,7 @@
                return;
        }
 
+       KASSERT(0 < next->r_refcnt);
        if (off < next->r_off) {
                /* Add a proxy for initial range before the overlap */
                zfs_range_new_proxy(tree, off, next->r_off - off, zp);
@@ -369,17 +375,20 @@
                if (off + len == next->r_off + next->r_len) {
                        /* exact overlap with end */
                        next = zfs_range_proxify(tree, next);
+                       KASSERT(0 < next->r_refcnt);
                        next->r_cnt++;
                        return;
                }
                if (off + len < next->r_off + next->r_len) {
                        /* new range ends in the middle of this block */
                        next = zfs_range_split(tree, next, off + len);
+                       KASSERT(0 < next->r_refcnt);
                        next->r_cnt++;
                        return;
                }
                ASSERT3U(off + len, >, next->r_off + next->r_len);
                next = zfs_range_proxify(tree, next);
+               KASSERT(0 < next->r_refcnt);
                next->r_cnt++;
        }
 



Home | Main Index | Thread Index | Old Index