ceph: don't rely on error_string to validate blocklisted session.
The "error_string" in the metadata of MClientSession is being parsed by kclient to validate whether the session is blocklisted. The "error_string" is for humans and shouldn't be relied on it. Hence added the flag to MClientsession to indicate the session is blocklisted. [ jlayton: minor formatting cleanup ] URL: https://tracker.ceph.com/issues/47450 Signed-off-by: Kotresh HR <khiremat@redhat.com> Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
25b7351161
commit
e1c9788cb3
2 changed files with 21 additions and 2 deletions
|
@ -3361,9 +3361,14 @@ static void handle_session(struct ceph_mds_session *session,
|
||||||
|
|
||||||
if (msg_version >= 3) {
|
if (msg_version >= 3) {
|
||||||
u32 len;
|
u32 len;
|
||||||
/* version >= 2, metadata */
|
/* version >= 2 and < 5, decode metadata, skip otherwise
|
||||||
if (__decode_session_metadata(&p, end, &blocklisted) < 0)
|
* as it's handled via flags.
|
||||||
|
*/
|
||||||
|
if (msg_version >= 5)
|
||||||
|
ceph_decode_skip_map(&p, end, string, string, bad);
|
||||||
|
else if (__decode_session_metadata(&p, end, &blocklisted) < 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
/* version >= 3, feature bits */
|
/* version >= 3, feature bits */
|
||||||
ceph_decode_32_safe(&p, end, len, bad);
|
ceph_decode_32_safe(&p, end, len, bad);
|
||||||
if (len) {
|
if (len) {
|
||||||
|
@ -3372,6 +3377,18 @@ static void handle_session(struct ceph_mds_session *session,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (msg_version >= 5) {
|
||||||
|
u32 flags;
|
||||||
|
/* version >= 4, struct_v, struct_cv, len, metric_spec */
|
||||||
|
ceph_decode_skip_n(&p, end, 2 + sizeof(u32) * 2, bad);
|
||||||
|
/* version >= 5, flags */
|
||||||
|
ceph_decode_32_safe(&p, end, flags, bad);
|
||||||
|
if (flags & CEPH_SESSION_BLOCKLISTED) {
|
||||||
|
pr_warn("mds%d session blocklisted\n", session->s_mds);
|
||||||
|
blocklisted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mutex_lock(&mdsc->mutex);
|
mutex_lock(&mdsc->mutex);
|
||||||
if (op == CEPH_SESSION_CLOSE) {
|
if (op == CEPH_SESSION_CLOSE) {
|
||||||
ceph_get_mds_session(session);
|
ceph_get_mds_session(session);
|
||||||
|
|
|
@ -302,6 +302,8 @@ enum {
|
||||||
CEPH_SESSION_REQUEST_FLUSH_MDLOG,
|
CEPH_SESSION_REQUEST_FLUSH_MDLOG,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define CEPH_SESSION_BLOCKLISTED (1 << 0) /* session blocklisted */
|
||||||
|
|
||||||
extern const char *ceph_session_op_name(int op);
|
extern const char *ceph_session_op_name(int op);
|
||||||
|
|
||||||
struct ceph_mds_session_head {
|
struct ceph_mds_session_head {
|
||||||
|
|
Loading…
Add table
Reference in a new issue