linux-stable/fs/ceph
Jeff Layton b4002173b7 ceph: cancel delayed work instead of flushing on mdsc teardown
The first thing metric_delayed_work does is check mdsc->stopping,
and then return immediately if it's set. That's good since we would
have already torn down the metric structures at this point, otherwise,
but there is no locking around mdsc->stopping.

It's possible that the ceph_metric_destroy call could race with the
delayed_work, in which case we could end up with the delayed_work
accessing destroyed percpu variables.

At this point in the mdsc teardown, the "stopping" flag has already been
set, so there's no benefit to flushing the work. Move the work
cancellation in ceph_metric_destroy ahead of the percpu variable
destruction, and eliminate the flush_delayed_work call in
ceph_mdsc_destroy.

Fixes: 18f473b384 ("ceph: periodically send perf metrics to MDSes")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2021-09-02 22:49:17 +02:00
..
acl.c fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
addr.c ceph: fix comment about short copies in ceph_write_end 2021-09-02 22:49:16 +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: flush the mdlog before waiting on unsafe reqs 2021-09-02 22:49:16 +02: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: take reference to req->r_parent at point of assignment 2021-06-29 00:15:52 +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: take reference to req->r_parent at point of assignment 2021-06-29 00:15:52 +02:00
inode.c ceph: eliminate ceph_async_iput() 2021-06-29 00:15:52 +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: fix up some warnings on W=1 builds 2020-12-14 23:21:47 +01:00
Makefile ceph: add dentry lease metric support 2020-06-01 13:22:51 +02:00
mds_client.c ceph: cancel delayed work instead of flushing on mdsc teardown 2021-09-02 22:49:17 +02:00
mds_client.h ceph: flush mdlog before umounting 2021-09-02 22:49:16 +02:00
mdsmap.c ceph: fix possible null-pointer dereference in ceph_mdsmap_decode() 2021-08-25 16:34:11 +02: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: correctly handle releasing an embedded cap flush 2021-08-25 16:34:11 +02:00
strings.c ceph: flush mdlog before umounting 2021-09-02 22:49:16 +02:00
super.c ceph: add new RECOVER mount_state when recovering session 2020-12-14 23:21:46 +01:00
super.h ceph: correctly handle releasing an embedded cap flush 2021-08-25 16:34:11 +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: add a new vxattr to return auth mds for an inode 2021-09-02 22:49:16 +02:00