Merge "locking/osq_lock: Fix osq_lock queue corruption"
This commit is contained in:
commit
34f1071c18
1 changed files with 13 additions and 0 deletions
|
@ -106,6 +106,19 @@ bool osq_lock(struct optimistic_spin_queue *lock)
|
|||
|
||||
prev = decode_cpu(old);
|
||||
node->prev = prev;
|
||||
|
||||
/*
|
||||
* osq_lock() unqueue
|
||||
*
|
||||
* node->prev = prev osq_wait_next()
|
||||
* WMB MB
|
||||
* prev->next = node next->prev = prev // unqueue-C
|
||||
*
|
||||
* Here 'node->prev' and 'next->prev' are the same variable and we need
|
||||
* to ensure these stores happen in-order to avoid corrupting the list.
|
||||
*/
|
||||
smp_wmb();
|
||||
|
||||
WRITE_ONCE(prev->next, node);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue