]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, inode: add support for symlinks and fix mtime/ctime
authorDaniel Borkmann <daniel@iogearbox.net>
Sat, 29 Oct 2016 00:30:46 +0000 (02:30 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 31 Oct 2016 19:28:11 +0000 (15:28 -0400)
commitc2d975eea2b284dfe295f6e7bee73c2f3796577b
treec3d3b65b840a10d2baf6f3e7e053017b8ba5204a
parent8908ce790da798d6a7bf79c3d07af95d3b7148ad
bpf, inode: add support for symlinks and fix mtime/ctime

While commit fe693308fa08 ("bpf, inode: allow for rename and link ops")
added support for hard links that can be used for prog and map nodes,
this work adds simple symlink support, which can be used f.e. for
directories also when unpriviledged and works with cmdline tooling that
understands S_IFLNK anyway. Since the switch in 559b85781b77 ("bpf: Use
mount_nodev not mount_ns to mount the bpf filesystem"), there can be
various mount instances with mount_nodev() and thus hierarchy can be
flattened to facilitate object sharing. Thus, we can keep bpf tooling
also working by repointing paths.

Most of the functionality can be used from vfs library operations. The
symlink is stored in the inode itself, that is in i_link, which is
sufficient in our case as opposed to storing it in the page cache.
While at it, I noticed that bpf_mkdir() and bpf_mkobj() don't update
the directories mtime and ctime, so add a common helper for it called
bpf_dentry_finalize() that takes care of it for all cases now.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/inode.c