On 3/21/23 14:04, Martin KaFai Lau wrote:
On 3/20/23 12:56 PM, Kui-Feng Lee wrote:
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 56a60ab2ca8f..f84d68c049e3 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -11639,6 +11639,11 @@ struct bpf_link
*bpf_map__attach_struct_ops(const struct bpf_map *map)
/* kern_vdata should be prepared during the loading phase. */
err = bpf_map_update_elem(map->fd, &zero,
map->st_ops->kern_vdata, 0);
+ /* It can be EBUSY if the map has been used to create or
+ * update a link before. We don't allow updating the value of
+ * a struct_ops once it is set. That ensures that the value
+ * never changed. So, it is safe to skip EBUSY.
+ */
This belongs to the earlier patch (4?).
Got it!
if (err && err != -EBUSY) {
free(link);
return libbpf_err_ptr(err);