linux/fs/ceph
Jeff Layton 62575e270f ceph: check session state after bumping session->s_seq
Some messages sent by the MDS entail a session sequence number
increment, and the MDS will drop certain types of requests on the floor
when the sequence numbers don't match.

In particular, a REQUEST_CLOSE message can cross with one of the
sequence morphing messages from the MDS which can cause the client to
stall, waiting for a response that will never come.

Originally, this meant an up to 5s delay before the recurring workqueue
job kicked in and resent the request, but a recent change made it so
that the client would never resend, causing a 60s stall unmounting and
sometimes a blockisting event.

Add a new helper for incrementing the session sequence and then testing
to see whether a REQUEST_CLOSE needs to be resent, and move the handling
of CEPH_MDS_SESSION_CLOSING into that function. Change all of the
bare sequence counter increments to use the new helper.

Reorganize check_session_state with a switch statement.  It should no
longer be called when the session is CLOSING, so throw a warning if it
ever is (but still handle that case sanely).

[ idryomov: whitespace, pr_err() call fixup ]

URL: https://tracker.ceph.com/issues/47563
Fixes: fa99677342 ("ceph: fix potential mdsc use-after-free crash")
Reported-by: Patrick Donnelly <pdonnell@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-11-04 20:55:49 +01:00
..
acl.c ceph: add caps perf metric for each superblock 2020-06-01 13:22:51 +02:00
addr.c ceph: promote to unsigned long long before shifting 2020-10-12 15:29:27 +02:00
cache.c ceph: replace zero-length array with flexible-array member 2020-03-30 12:42:40 +02:00
cache.h libceph, rbd, ceph: convert to use the new mount API 2019-11-27 22:28:37 +01:00
caps.c ceph: check session state after bumping session->s_seq 2020-11-04 20:55:49 +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: metrics for opened files, pinned caps and opened inodes 2020-10-12 15:29:26 +02:00
dir.c ceph: add ceph_sb_to_mdsc helper support to parse the mdsc 2020-10-12 15:29:26 +02:00
export.c ceph: don't return -ESTALE if there's still an open file 2020-06-01 13:22:53 +02:00
file.c libceph, rbd, ceph: "blacklist" -> "blocklist" 2020-10-12 15:29:26 +02:00
inode.c ceph: metrics for opened files, pinned caps and opened inodes 2020-10-12 15:29:26 +02:00
io.c ceph: add buffered/direct exclusionary locking for reads and writes 2019-09-16 12:06:25 +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 libceph: replace HTTP links with HTTPS ones 2020-08-03 11:05:26 +02:00
locks.c ceph: add ceph_sb_to_mdsc helper support to parse the mdsc 2020-10-12 15:29:26 +02:00
Makefile ceph: add dentry lease metric support 2020-06-01 13:22:51 +02:00
mds_client.c ceph: check session state after bumping session->s_seq 2020-11-04 20:55:49 +01:00
mds_client.h ceph: check session state after bumping session->s_seq 2020-11-04 20:55:49 +01:00
mdsmap.c ceph: remove unused variables in ceph_mdsmap_decode() 2020-08-03 11:05:27 +02:00
metric.c ceph: metrics for opened files, pinned caps and opened inodes 2020-10-12 15:29:26 +02:00
metric.h ceph: metrics for opened files, pinned caps and opened inodes 2020-10-12 15:29:26 +02:00
quota.c ceph: check session state after bumping session->s_seq 2020-11-04 20:55:49 +01:00
snap.c ceph: check session state after bumping session->s_seq 2020-11-04 20:55:49 +01:00
strings.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
super.c Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-10-24 12:26:05 -07:00
super.h ceph: comment cleanups and clarifications 2020-10-12 15:29:27 +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: mark ceph_fmt_xattr() as printf-like for better type checking 2020-10-12 15:29:27 +02:00