diff options
| author | Qiuwen Lu <[email protected]> | 2016-09-20 10:15:09 +0800 |
|---|---|---|
| committer | Qiuwen Lu <[email protected]> | 2016-09-20 10:15:09 +0800 |
| commit | 2678cdce677a3e82294d5c307cc1120b36281f5a (patch) | |
| tree | 3cfb0d4f20567979a62181b8be72ae66983f01bf | |
| parent | 819f59f9dc07fb6446b5b6fadcb2e06feb5837bf (diff) | |
修正VNode在dup失败后可能在队列中写入空指针的Bug
| -rw-r--r-- | core/src/vnode.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/src/vnode.c b/core/src/vnode.c index 9fa3cf6..5bd36a0 100644 --- a/core/src/vnode.c +++ b/core/src/vnode.c @@ -306,6 +306,7 @@ void tunnel_block_enqueue_with_hash(struct tunnel_block * block, struct vnode_op for (unsigned int i = 0; i < nr_obj; i++) { + assert(obj[i] != NULL); consq = hash[i] % block->nr_consq; tunnel = *tunnel_block_index(block, prodq, consq); tunnel_enqueue(tunnel, ops, obj[i]); @@ -827,7 +828,7 @@ int vnode_enqueue_burst_with_hash(struct vnode_prod * prod, struct vnode_ops * o for (int i = 0; i < nr_objects; i++) { dup_objects[nr_dup_objects] = ops->op_object_dup(objects[i]); - if (likely(dup_objects[i] != NULL)) + if (likely(dup_objects[nr_dup_objects] != NULL)) { nr_dup_objects++; UPDATE_VNODE_STAT(object_dup_success, 1); @@ -835,6 +836,7 @@ int vnode_enqueue_burst_with_hash(struct vnode_prod * prod, struct vnode_ops * o else UPDATE_VNODE_STAT(object_dup_fail, 1); } + //TODO: Dup错误之后,hash值如何对应 tunnel_block_enqueue_with_hash(tblist_item_iter->block, ops, prodq, dup_objects, hash, nr_dup_objects); } |
