]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
I found that in function lruhash_remove, table was locked at first ,then lru_remove... 399/head
authorxiangbao227 <1004129700@qq.com>
Wed, 13 Jan 2021 02:33:41 +0000 (10:33 +0800)
committerxiangbao227 <1004129700@qq.com>
Wed, 13 Jan 2021 02:33:41 +0000 (10:33 +0800)
util/storage/lruhash.c

index 0003ff491e46198416280b0b1af7c1cea22ab8b4..3500a4ef0fe894a1dfa6f421a9e523488c0e0c06 100644 (file)
@@ -398,13 +398,13 @@ lruhash_remove(struct lruhash* table, hashvalue_type hash, void* key)
                return;
        }
        table->num--;
-       table->space_used -= (*table->sizefunc)(entry->key, entry->data);
-       lock_quick_unlock(&table->lock);
+       table->space_used -= (*table->sizefunc)(entry->key, entry->data);       
        lock_rw_wrlock(&entry->lock);
        if(table->markdelfunc)
                (*table->markdelfunc)(entry->key);
        lock_rw_unlock(&entry->lock);
        lock_quick_unlock(&bin->lock);
+       lock_quick_unlock(&table->lock);
        /* finish removal */
        d = entry->data;
        (*table->delkeyfunc)(entry->key, table->cb_arg);