OpenCloudOS-Kernel/fs/ceph
Patrick Donnelly b8c118c2a2 ceph: fix cap ref leak via netfs init_request
commit ccda9910d8490f4fb067131598e4b2e986faa5a0 upstream.

Log recovered from a user's cluster:

    <7>[ 5413.970692] ceph:  get_cap_refs 00000000958c114b ret 1 got Fr
    <7>[ 5413.970695] ceph:  start_read 00000000958c114b, no cache cap
    ...
    <7>[ 5473.934609] ceph:   my wanted = Fr, used = Fr, dirty -
    <7>[ 5473.934616] ceph:  revocation: pAsLsXsFr -> pAsLsXs (revoking Fr)
    <7>[ 5473.934632] ceph:  __ceph_caps_issued 00000000958c114b cap 00000000f7784259 issued pAsLsXs
    <7>[ 5473.934638] ceph:  check_caps 10000000e68.fffffffffffffffe file_want - used Fr dirty - flushing - issued pAsLsXs revoking Fr retain pAsLsXsFsr  AUTHONLY NOINVAL FLUSH_FORCE

The MDS subsequently complains that the kernel client is late releasing
caps.

Approximately, a series of changes to this code by commits 4987005600
("ceph: convert ceph_readpages to ceph_readahead"), 2de1604173
("netfs: Change ->init_request() to return an error code") and
a5c9dc4451 ("ceph: Make ceph_init_request() check caps on readahead")
resulted in subtle resource cleanup to be missed. The main culprit is
the change in error handling in 2de1604173 which meant that a failure
in init_request() would no longer cause cleanup to be called. That
would prevent the ceph_put_cap_refs() call which would cleanup the
leaked cap ref.

Cc: stable@vger.kernel.org
Fixes: a5c9dc4451 ("ceph: Make ceph_init_request() check caps on readahead")
Link: https://tracker.ceph.com/issues/67008
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-10 11:57:59 +02:00
..
Kconfig ceph: select FS_ENCRYPTION_ALGS if FS_ENCRYPTION 2024-01-25 15:35:44 -08:00
Makefile ceph: fscrypt_auth handling for ceph 2023-08-22 09:01:48 +02:00
acl.c Mixed with some fixes and cleanups, this brings in reasonably complete 2023-09-06 12:10:15 -07:00
addr.c ceph: fix cap ref leak via netfs init_request 2024-10-10 11:57:59 +02:00
cache.c ceph: rename _to_client() to _to_fs_client() 2024-04-27 17:11:29 +02:00
cache.h netfs: Further cleanups after struct netfs_inode wrapper introduced 2022-06-10 20:55:21 +01:00
caps.c ceph: rename _to_client() to _to_fs_client() 2024-04-27 17:11:29 +02:00
ceph_frag.c
crypto.c ceph: rename _to_client() to _to_fs_client() 2024-04-27 17:11:29 +02:00
crypto.h ceph: add support for encrypted snapshot names 2023-08-24 11:24:36 +02:00
debugfs.c ceph: pass the mdsc to several helpers 2024-04-27 17:11:29 +02:00
dir.c ceph: rename _to_client() to _to_fs_client() 2024-04-27 17:11:29 +02:00
export.c ceph: rename _to_client() to _to_fs_client() 2024-04-27 17:11:29 +02:00
file.c ceph: rename _to_client() to _to_fs_client() 2024-04-27 17:11:29 +02:00
inode.c ceph: rename _to_client() to _to_fs_client() 2024-04-27 17:11:29 +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: rename _to_client() to _to_fs_client() 2024-04-27 17:11:29 +02:00
ioctl.h
locks.c filelock: move file locking definitions to separate header file 2023-01-11 06:52:32 -05:00
mds_client.c ceph: rename _to_client() to _to_fs_client() 2024-04-27 17:11:29 +02:00
mds_client.h ceph: pass the mdsc to several helpers 2024-04-27 17:11:29 +02:00
mdsmap.c ceph: pass the mdsc to several helpers 2024-04-27 17:11:29 +02:00
metric.c ceph: never send metrics if disable_send_metrics is set 2023-07-24 13:15:39 +02: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 invalid pointer access if get_quota_realm return ERR_PTR 2024-02-05 20:14:33 +00:00
snap.c ceph: rename _to_client() to _to_fs_client() 2024-04-27 17:11:29 +02:00
strings.c ceph: add getvxattr op 2022-03-01 18:26:37 +01:00
super.c ceph: fix incorrect kmalloc size of pagevec mempool 2024-08-03 08:54:40 +02:00
super.h ceph: rename _to_client() to _to_fs_client() 2024-04-27 17:11:29 +02: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: rename _to_client() to _to_fs_client() 2024-04-27 17:11:29 +02:00