Fcntl(..., F GETLK, ...) does not return correct info about a read lock which is set on server
From Linux NFS
About
- Kernel version: 2.6.22-rc1 and higher
- Bug 23892
- Reported by: Alexander Morozov (November 28, 2010)
- Fixed by: Florain Mickler (January 23, 2010)
How to reproduce
- Environment:
Debian Lenny with kernel 2.6.37-rc3 i686 nfs-common 1:1.1.2-6lenny2 nfs-kernel-server 1:1.1.2-6lenny2 172.22.0.10 is a server 172.22.0.11 is a client
- /etc/exports on a server:
/srv/test 172.22.0.11(rw,sync,no_subtree_check)
- Steps to reproduce:
client# mount -t nfs 172.22.0.10:/srv/test /srv/test server$ cd /srv/test server$ ./linlock r file press Ctrl-C... client$ cd /srv/test client$ ./linlock w file fcntl: Resource temporary unavailable client$ ./lockinfo file F_UNLCK SEEK_SET start 0 len 0
- ./linlock tool set read (r) or write (w) lock on a file.
- ./lockinfo shows what F_GETLK returns. This test shows that a client can not set a write lock on a read lock of server but F_GETLK tells that file is not locked.
- The bug does not occur if client with 2.6.21 kernel.
- The bug occurs if client with 2.6.22-rc1 and higher.