Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ceph: fail the request if the peer MDS doesn't support getvxattr op

Just fail the request instead sending the request out, or the peer
MDS will crash.

Link: https://tracker.ceph.com/issues/56529
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

authored by

Xiubo Li and committed by
Ilya Dryomov
6eb06c46 f7913573

+17 -1
+1
fs/ceph/inode.c
··· 2356 2356 goto out; 2357 2357 } 2358 2358 2359 + req->r_feature_needed = CEPHFS_FEATURE_OP_GETVXATTR; 2359 2360 req->r_path2 = kstrdup(name, GFP_NOFS); 2360 2361 if (!req->r_path2) { 2361 2362 err = -ENOMEM;
+11
fs/ceph/mds_client.c
··· 2318 2318 INIT_LIST_HEAD(&req->r_unsafe_dir_item); 2319 2319 INIT_LIST_HEAD(&req->r_unsafe_target_item); 2320 2320 req->r_fmode = -1; 2321 + req->r_feature_needed = -1; 2321 2322 kref_init(&req->r_kref); 2322 2323 RB_CLEAR_NODE(&req->r_node); 2323 2324 INIT_LIST_HEAD(&req->r_wait); ··· 2917 2916 2918 2917 dout("do_request mds%d session %p state %s\n", mds, session, 2919 2918 ceph_session_state_name(session->s_state)); 2919 + 2920 + /* 2921 + * The old ceph will crash the MDSs when see unknown OPs 2922 + */ 2923 + if (req->r_feature_needed > 0 && 2924 + !test_bit(req->r_feature_needed, &session->s_features)) { 2925 + err = -EOPNOTSUPP; 2926 + goto out_session; 2927 + } 2928 + 2920 2929 if (session->s_state != CEPH_MDS_SESSION_OPEN && 2921 2930 session->s_state != CEPH_MDS_SESSION_HUNG) { 2922 2931 /*
+5 -1
fs/ceph/mds_client.h
··· 31 31 CEPHFS_FEATURE_METRIC_COLLECT, 32 32 CEPHFS_FEATURE_ALTERNATE_NAME, 33 33 CEPHFS_FEATURE_NOTIFY_SESSION_STATE, 34 + CEPHFS_FEATURE_OP_GETVXATTR, 34 35 35 - CEPHFS_FEATURE_MAX = CEPHFS_FEATURE_NOTIFY_SESSION_STATE, 36 + CEPHFS_FEATURE_MAX = CEPHFS_FEATURE_OP_GETVXATTR, 36 37 }; 37 38 38 39 #define CEPHFS_FEATURES_CLIENT_SUPPORTED { \ ··· 45 44 CEPHFS_FEATURE_DELEG_INO, \ 46 45 CEPHFS_FEATURE_METRIC_COLLECT, \ 47 46 CEPHFS_FEATURE_NOTIFY_SESSION_STATE, \ 47 + CEPHFS_FEATURE_OP_GETVXATTR, \ 48 48 } 49 49 50 50 /* ··· 337 335 long long r_dir_release_cnt; 338 336 long long r_dir_ordered_cnt; 339 337 int r_readdir_cache_idx; 338 + 339 + int r_feature_needed; 340 340 341 341 struct ceph_cap_reservation r_caps_reservation; 342 342 };