diff options
| author | Sidhartha Kumar <[email protected]> | 2024-08-12 15:05:42 -0400 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2024-09-01 20:26:11 -0700 |
| commit | e1b8b883bb838339eec728de5d02e2f252a7d3d9 (patch) | |
| tree | 7bd24fe4e83d6de301736d69e3df2df420fdb028 /tools/perf/scripts/python/parallel-perf.py | |
| parent | c0f398c3b2cf67976bca216f80668b9c93368385 (diff) | |
maple_tree: reset mas->index and mas->last on write retries
The following scenario can result in a race condition:
Consider a node with the following indices and values
a<------->b<----------->c<--------->d
0xA NULL 0xB
CPU 1 CPU 2
--------- ---------
mas_set_range(a,b)
mas_erase()
-> range is expanded (a,c) because of null expansion
mas_nomem()
mas_unlock()
mas_store_range(b,c,0xC)
The node now looks like:
a<------->b<----------->c<--------->d
0xA 0xC 0xB
mas_lock()
mas_erase() <------ range of erase is still (a,c)
The node is now NULL from (a,c) but the write from CPU 2 should have been
retained and range (b,c) should still have 0xC as its value. We can fix
this by re-intializing to the original index and last. This does not need
a cc: Stable as there are no users of the maple tree which use internal
locking and this condition is only possible with internal locking.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Sidhartha Kumar <[email protected]>
Reviewed-by: Liam R. Howlett <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/parallel-perf.py')
0 files changed, 0 insertions, 0 deletions