linux/fs/ceph
Xiubo Li da9c9883ec ceph: switch to vfs_inode_has_locks() to fix file lock bug
[ Upstream commit 461ab10ef7 ]

For the POSIX locks they are using the same owner, which is the
thread id. And multiple POSIX locks could be merged into single one,
so when checking whether the 'file' has locks may fail.

For a file where some openers use locking and others don't is a
really odd usage pattern though. Locks are like stoplights -- they
only work if everyone pays attention to them.

Just switch ceph_get_caps() to check whether any locks are set on
the inode. If there are POSIX/OFD/FLOCK locks on the file at the
time, we should set CHECK_FILELOCK, regardless of what fd was used
to set the lock.

Fixes: ff5d913dfc ("ceph: return -EIO if read/write against filp that lost file locks")
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-01-12 11:59:14 +01:00
..
Kconfig
Makefile
acl.c
addr.c ceph: switch netfs read ops to use rreq->inode instead of rreq->mapping->host 2022-07-21 21:24:30 +02:00
cache.c
cache.h
caps.c ceph: switch to vfs_inode_has_locks() to fix file lock bug 2023-01-12 11:59:14 +01:00
ceph_frag.c
debugfs.c
dir.c
export.c
file.c ceph: don't truncate file in atomic_open 2022-10-15 07:59:01 +02:00
inode.c
io.c
io.h
ioctl.c
ioctl.h
locks.c ceph: switch to vfs_inode_has_locks() to fix file lock bug 2023-01-12 11:59:14 +01:00
mds_client.c ceph: use correct index when encoding client supported features 2022-08-25 11:40:13 +02:00
mds_client.h ceph: use correct index when encoding client supported features 2022-08-25 11:40:13 +02:00
mdsmap.c
metric.c
metric.h
quota.c
snap.c ceph: avoid putting the realm twice when decoding snaps fails 2022-12-02 17:41:00 +01:00
strings.c
super.c
super.h ceph: switch to vfs_inode_has_locks() to fix file lock bug 2023-01-12 11:59:14 +01:00
util.c
xattr.c