Advisory file locking behaviour of bpf_link (and others?)

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

 



Hi,

I was playing around a bit, and noticed that trying to acquire an
exclusive POSIX record lock on a bpf_link fd fails. I've traced this
to the call to anon_inode_getfile from bpf_link_prime which
effectively specifies O_RDONLY on the bpf_link struct file. This makes
check_fmode_for_setlk return EBADF.

This means the following:
* flock(link, LOCK_EX): works
* fcntl(link, SETLK, F_RDLCK): works
* fcntl(link, SETLK, F_WRLCK): doesn't work

Especially the discrepancy between flock(EX) and fcntl(WRLCK) has me
puzzled. Should fcntl(WRLCK) work on a link?

program fds are always O_RDWR as far as I can tell (so all locks
work), while maps depend on map_flags.

Best
Lorenz

-- 
Lorenz Bauer  |  Systems Engineer
6th Floor, County Hall/The Riverside Building, SE1 7PB, UK

www.cloudflare.com



[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