> You are worried about the case where an application should be able to > unpin the map before loading a new one so it doesn't get reused? No, I'm worried about the opposite: Someone running (the equivalent of) 'ip link set dev eth0 xdp off', and then wondering why all resources aren't freed. I do believe that the common case could be solved by a logic similar to the one I proposed, though: >> Hmm, but I guess it could do that anyway; so maybe what we need is just >> a "try to find all pinned maps of this program" function? That could >> then to something like: >> >> - Get the maps IDs and names of all maps attached to that program from >> the kernel. >> >> - Look for each map name in /sys/fs/bpf >> >> - If a pinned map with the same name exists, compare the IDs, and unlink >> if they match >> >> I don't suppose it'll be possible to do all that in a race-free manner, >> but that would go for any use of unlink() unless I'm missing something?