bpf: Only call maybe_wait_bpf_programs() when map operation succeeds
There is no need to call maybe_wait_bpf_programs() if update or deletion operation fails. So only call maybe_wait_bpf_programs() if update or deletion operation succeeds. Signed-off-by: Hou Tao <houtao1@huawei.com> Link: https://lore.kernel.org/r/20231208102355.2628918-5-houtao@huaweicloud.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
012772581d
commit
67ad2c73ff
@ -1576,7 +1576,8 @@ static int map_update_elem(union bpf_attr *attr, bpfptr_t uattr)
|
||||
}
|
||||
|
||||
err = bpf_map_update_value(map, f.file, key, value, attr->flags);
|
||||
maybe_wait_bpf_programs(map);
|
||||
if (!err)
|
||||
maybe_wait_bpf_programs(map);
|
||||
|
||||
kvfree(value);
|
||||
free_key:
|
||||
@ -1632,7 +1633,8 @@ static int map_delete_elem(union bpf_attr *attr, bpfptr_t uattr)
|
||||
err = map->ops->map_delete_elem(map, key);
|
||||
rcu_read_unlock();
|
||||
bpf_enable_instrumentation();
|
||||
maybe_wait_bpf_programs(map);
|
||||
if (!err)
|
||||
maybe_wait_bpf_programs(map);
|
||||
out:
|
||||
kvfree(key);
|
||||
err_put:
|
||||
|
Loading…
Reference in New Issue
Block a user