.. | .. |
---|
48 | 48 | return map->ops->map_owner_storage_ptr(owner); |
---|
49 | 49 | } |
---|
50 | 50 | |
---|
| 51 | +static bool selem_linked_to_storage_lockless(const struct bpf_local_storage_elem *selem) |
---|
| 52 | +{ |
---|
| 53 | + return !hlist_unhashed_lockless(&selem->snode); |
---|
| 54 | +} |
---|
| 55 | + |
---|
51 | 56 | static bool selem_linked_to_storage(const struct bpf_local_storage_elem *selem) |
---|
52 | 57 | { |
---|
53 | 58 | return !hlist_unhashed(&selem->snode); |
---|
| 59 | +} |
---|
| 60 | + |
---|
| 61 | +static bool selem_linked_to_map_lockless(const struct bpf_local_storage_elem *selem) |
---|
| 62 | +{ |
---|
| 63 | + return !hlist_unhashed_lockless(&selem->map_node); |
---|
54 | 64 | } |
---|
55 | 65 | |
---|
56 | 66 | static bool selem_linked_to_map(const struct bpf_local_storage_elem *selem) |
---|
.. | .. |
---|
140 | 150 | struct bpf_local_storage *local_storage; |
---|
141 | 151 | bool free_local_storage = false; |
---|
142 | 152 | |
---|
143 | | - if (unlikely(!selem_linked_to_storage(selem))) |
---|
| 153 | + if (unlikely(!selem_linked_to_storage_lockless(selem))) |
---|
144 | 154 | /* selem has already been unlinked from sk */ |
---|
145 | 155 | return; |
---|
146 | 156 | |
---|
.. | .. |
---|
167 | 177 | struct bpf_local_storage_map *smap; |
---|
168 | 178 | struct bpf_local_storage_map_bucket *b; |
---|
169 | 179 | |
---|
170 | | - if (unlikely(!selem_linked_to_map(selem))) |
---|
| 180 | + if (unlikely(!selem_linked_to_map_lockless(selem))) |
---|
171 | 181 | /* selem has already be unlinked from smap */ |
---|
172 | 182 | return; |
---|
173 | 183 | |
---|
.. | .. |
---|
365 | 375 | err = check_flags(old_sdata, map_flags); |
---|
366 | 376 | if (err) |
---|
367 | 377 | return ERR_PTR(err); |
---|
368 | | - if (old_sdata && selem_linked_to_storage(SELEM(old_sdata))) { |
---|
| 378 | + if (old_sdata && selem_linked_to_storage_lockless(SELEM(old_sdata))) { |
---|
369 | 379 | copy_map_value_locked(&smap->map, old_sdata->data, |
---|
370 | 380 | value, false); |
---|
371 | 381 | return old_sdata; |
---|