Commit f19c39d
libbpf: check if pin_path was set even map fd exist
Say a user reuse map fd after creating a map manually and set the
pin_path, then load the object via libbpf.
In libbpf bpf_object__create_maps(), bpf_object__reuse_map() will
return 0 if there is no pinned map in map->pin_path. Then after
checking if map fd exist, we should also check if pin_path was set
and do bpf_map__pin() instead of continue the loop.
Fix it by creating map if fd not exist and continue checking pin_path
after that.
v2: keep if condition with existing order
Suggested-by: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>1 parent f87d39d commit f19c39d
1 file changed
+18
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4256 | 4256 | | |
4257 | 4257 | | |
4258 | 4258 | | |
4259 | | - | |
4260 | | - | |
4261 | | - | |
4262 | | - | |
4263 | | - | |
4264 | | - | |
| 4259 | + | |
| 4260 | + | |
| 4261 | + | |
| 4262 | + | |
4265 | 4263 | | |
4266 | | - | |
4267 | | - | |
| 4264 | + | |
| 4265 | + | |
4268 | 4266 | | |
4269 | | - | |
4270 | | - | |
4271 | | - | |
4272 | | - | |
4273 | | - | |
| 4267 | + | |
| 4268 | + | |
| 4269 | + | |
| 4270 | + | |
| 4271 | + | |
| 4272 | + | |
4274 | 4273 | | |
4275 | | - | |
4276 | 4274 | | |
4277 | | - | |
4278 | | - | |
4279 | | - | |
4280 | | - | |
4281 | | - | |
| 4275 | + | |
| 4276 | + | |
| 4277 | + | |
| 4278 | + | |
| 4279 | + | |
| 4280 | + | |
4282 | 4281 | | |
4283 | 4282 | | |
4284 | 4283 | | |
| |||
0 commit comments