diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2016-06-15 22:47:12 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-06-15 23:42:57 -0700 |
commit | 61d1b6a42fec61c5065f54cc62cef02b483c69fb (patch) | |
tree | eb4b02ef08e8f73fd394fadb0b5e15008394c142 /kernel | |
parent | b478af0cd7957faca83779fe6832abae163f7159 (diff) | |
download | linux-61d1b6a42fec61c5065f54cc62cef02b483c69fb.tar.bz2 |
bpf, maps: add release callback
Add a release callback for maps that is invoked when the last
reference to its struct file is gone and the struct file about
to be released by vfs. The handler will be used by fd array maps.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/bpf/syscall.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 46ecce4b79ed..fc3adcd064b1 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -124,7 +124,12 @@ void bpf_map_put_with_uref(struct bpf_map *map) static int bpf_map_release(struct inode *inode, struct file *filp) { - bpf_map_put_with_uref(filp->private_data); + struct bpf_map *map = filp->private_data; + + if (map->ops->map_release) + map->ops->map_release(map, filp); + + bpf_map_put_with_uref(map); return 0; } |