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
..
acl.c vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
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 ceph: rip out old fscache readpage handling 2021-04-27 23:52:21 +02:00
cache.h ceph: remove some defunct forward declarations 2021-09-02 22:49:16 +02:00
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 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
debugfs.c ceph: add IO size metrics support 2021-06-29 00:15:51 +02:00
dir.c ceph: fix memory leak in ceph_readdir when note_last_dentry returns error 2022-04-13 20:59:10 +02:00
export.c ceph: take reference to req->r_parent at point of assignment 2021-06-29 00:15:52 +02:00
file.c ceph: don't truncate file in atomic_open 2022-10-15 07:59:01 +02:00
inode.c ceph: fix inode reference leakage in ceph_get_snapdir() 2022-04-13 20:59:10 +02:00
io.c ceph: fix kerneldoc copypasta over ceph_start_io_direct 2021-04-27 23:52:23 +02:00
io.h ceph: add buffered/direct exclusionary locking for reads and writes 2019-09-16 12:06:25 +02:00
ioctl.c ceph: consider inode's last read/write when calculating wanted caps 2020-03-30 12:42:42 +02:00
ioctl.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig ceph: convert ceph_readpage to netfs_readpage 2021-04-27 23:52:22 +02:00
locks.c ceph: switch to vfs_inode_has_locks() to fix file lock bug 2023-01-12 11:59:14 +01:00
Makefile ceph: add dentry lease metric support 2020-06-01 13:22:51 +02: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 ceph: fix mdsmap decode when there are MDS's beyond max_mds 2021-11-18 19:17:15 +01:00
metric.c ceph: cancel delayed work instead of flushing on mdsc teardown 2021-09-02 22:49:17 +02:00
metric.h ceph: add IO size metrics support 2021-06-29 00:15:51 +02:00
quota.c ceph: eliminate ceph_async_iput() 2021-06-29 00:15:52 +02:00
snap.c ceph: avoid putting the realm twice when decoding snaps fails 2022-12-02 17:41:00 +01:00
strings.c ceph: flush mdlog before umounting 2021-09-02 22:49:16 +02:00
super.c ceph: properly handle statfs on multifs setups 2021-12-01 09:04:55 +01:00
super.h ceph: switch to vfs_inode_has_locks() to fix file lock bug 2023-01-12 11:59:14 +01:00
util.c ceph: move net/ceph/ceph_fs.c to fs/ceph/util.c 2020-01-27 16:53:40 +01:00
xattr.c ceph: allow ceph.dir.rctime xattr to be updatable 2022-06-14 18:36:23 +02:00