Skip to contentSkip to conversation

ceph: don't WARN if we're still opening a session to an MDS

PATCH In review Luis Henriques 2 participants 2 messages Jul 15, 2021 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: don't WARN if we're still opening a session to an MDS

If MDSs aren't available while mounting a filesystem, the session state will transition from SESSION_OPENING to SESSION_CLOSING. And in that scenario check_session_state() will be called from delayed_work() and trigger this WARN.

Avoid this by only WARNing after a session has already been established (i.e., the s_ttl will be different from 0).

Fixes 62575e270f66 ("ceph: check session state after bumping session->s_seq")
---
 fs/ceph/mds_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/mds_client.c +1 -1
index e5af591d3bd4..86f09b1110a2 100644
@@ -4468,7 +4468,7 @@ bool check_session_state(struct ceph_mds_session *s)
 		break;
 	case CEPH_MDS_SESSION_CLOSING:
 		/* Should never reach this when we're unmounting */
-		WARN_ON_ONCE(true);
+		WARN_ON_ONCE(s->s_ttl);
 		fallthrough;
 	case CEPH_MDS_SESSION_NEW:
 	case CEPH_MDS_SESSION_RESTARTING:
#1 lore raw
Quoted 19 lines · Luis Henriques

If MDSs aren't available while mounting a filesystem, the session state will transition from SESSION_OPENING to SESSION_CLOSING. And in that scenario check_session_state() will be called from delayed_work() and trigger this WARN.

Avoid this by only WARNing after a session has already been established (i.e., the s_ttl will be different from 0).

Fixes 62575e270f66 ("ceph: check session state after bumping session->s_seq")
---
 fs/ceph/mds_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/mds_client.c +0 -0
index e5af591d3bd4..86f09b1110a2 100644

fs/ceph/mds_client.c bool check_session_state(struct ceph_mds_session *s) · line 4474

Quoted 8 lines
fs/ceph/mds_client.c +1 -1
@@ -4468,7 +4468,7 @@ bool check_session_state(struct ceph_mds_session *s)
 		break;
 	case CEPH_MDS_SESSION_CLOSING:
 		/* Should never reach this when we're unmounting */
-		WARN_ON_ONCE(true);
+		WARN_ON_ONCE(s->s_ttl);
 		fallthrough;
 	case CEPH_MDS_SESSION_NEW:
 	case CEPH_MDS_SESSION_RESTARTING:

Mea culpa -- I've been meaning to fix that up. I'll plan to merge this later today.

Thanks!

Signature · 1 line
Jeff Layton <[email protected]>