[SPDK] thread->msg_cache is not safe when multiple threads send messages to same spdk_thread
sunshihao at huawei.com
| Newsgroups | dev.linux.lists.spdk |
|---|---|
| Message-ID | <[email protected]> |
hello,maintainer:
when i use spdk api spdk_thread_send_msg to send io read/write msg,i found a bug:
multiple threads send msg to one spdk_thread,they may get msg form local_thread->msg_cache,there is not a lock or cas to
ensure the safety of the linked list。
msg = NULL;
if (local_thread != NULL) {
if (local_thread->msg_cache_count > 0) {
msg = SLIST_FIRST(&local_thread->msg_cache); /* here maybe not thread safe */
assert(msg != NULL);
SLIST_REMOVE_HEAD(&local_thread->msg_cache, link);
local_thread->msg_cache_count--;
}
}
i don't konw whether is my wrong way to use spdk_thread_send_msg or the list is not safe,so please give me some advice。
Thank you!