linux-stable/fs/ceph
Xiubo Li 0bb21a6bf4 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 12:00:39 +01:00
..
Kconfig ceph: conversion to new fscache API 2022-01-11 22:13:01 +00:00
Makefile ceph: add dentry lease metric support 2020-06-01 13:22:51 +02:00
acl.c vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
addr.c We have a good pile of various fixes and cleanups from Xiubo, Jeff, 2022-08-11 12:41:07 -07:00
cache.c netfs: Fix gcc-12 warning by embedding vfs inode in netfs_i_context 2022-06-09 13:55:00 -07:00
cache.h netfs: Further cleanups after struct netfs_inode wrapper introduced 2022-06-10 20:55:21 +01:00
caps.c ceph: switch to vfs_inode_has_locks() to fix file lock bug 2023-01-12 12:00:39 +01:00
ceph_frag.c
debugfs.c ceph: use tracked average r/w/m latencies to display metrics in debugfs 2022-03-21 13:35:16 +01:00
dir.c ceph: wait for the first reply of inflight async unlink 2022-08-03 00:54:12 +02:00
export.c ceph: shut down access to inode when async create fails 2021-11-08 03:29:51 +01:00
file.c We have a good pile of various fixes and cleanups from Xiubo, Jeff, 2022-08-11 12:41:07 -07:00
inode.c ceph: don't get the inline data for new creating files 2022-08-03 00:54:12 +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
locks.c ceph: switch to vfs_inode_has_locks() to fix file lock bug 2023-01-12 12:00:39 +01:00
mds_client.c ceph: update the auth cap when the async create req is forwarded 2022-08-03 00:54:12 +02:00
mds_client.h ceph: add session already open notify support 2022-08-03 00:54:12 +02:00
mdsmap.c ceph: prevent a client from exceeding the MDS maximum xattr size 2022-08-03 00:54:12 +02:00
metric.c ceph: include average/stdev r/w/m latency in mds metrics 2022-03-21 13:35:16 +01:00
metric.h ceph: include average/stdev r/w/m latency in mds metrics 2022-03-21 13:35:16 +01:00
quota.c ceph: fix statfs for subdir mounts 2022-05-25 20:45:14 +02:00
snap.c ceph: avoid putting the realm twice when decoding snaps fails 2022-11-26 09:27:49 +01:00
strings.c ceph: add getvxattr op 2022-03-01 18:26:37 +01:00
super.c ceph: make f_bsize always equal to f_frsize 2022-08-03 00:54:13 +02:00
super.h ceph: switch to vfs_inode_has_locks() to fix file lock bug 2023-01-12 12:00:39 +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: prevent a client from exceeding the MDS maximum xattr size 2022-08-03 00:54:12 +02:00