Re: [PATCH bpf-next v9 6/8] libbpf: Update a bpf_link with another struct_ops.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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);




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux