ceph: reconnect connection if session hang in opening state
diff mbox series

Message ID 20190828132245.53155-1-chenerqi@gmail.com
State New
Headers show
Series
  • ceph: reconnect connection if session hang in opening state
Related show

Commit Message

erqi chen Aug. 28, 2019, 1:22 p.m. UTC
From: Erqi Chen <chenerqi@gmail.com>

If client mds session is evicted in CEPH_MDS_SESSION_OPENING state,
mds won't send session msg to client, and delayed_work skip
CEPH_MDS_SESSION_OPENING state session, the session hang forever.
ceph_con_keepalive reconnct connection for CEPH_MDS_SESSION_OPENING
session to avoid session hang.

Fixes: https://tracker.ceph.com/issues/41551
Signed-off-by: Erqi Chen chenerqi@gmail.com
---
 fs/ceph/mds_client.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Yan, Zheng Aug. 28, 2019, 1:38 p.m. UTC | #1
On Wed, Aug 28, 2019 at 9:24 PM <chenerqi@gmail.com> wrote:
>
> From: Erqi Chen <chenerqi@gmail.com>
>
> If client mds session is evicted in CEPH_MDS_SESSION_OPENING state,
> mds won't send session msg to client, and delayed_work skip
> CEPH_MDS_SESSION_OPENING state session, the session hang forever.
> ceph_con_keepalive reconnct connection for CEPH_MDS_SESSION_OPENING
> session to avoid session hang.
>
> Fixes: https://tracker.ceph.com/issues/41551
> Signed-off-by: Erqi Chen chenerqi@gmail.com
> ---
>  fs/ceph/mds_client.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 920e9f0..3d589c0 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -4044,7 +4044,9 @@ static void delayed_work(struct work_struct *work)
>                                 pr_info("mds%d hung\n", s->s_mds);
>                         }
>                 }
> -               if (s->s_state < CEPH_MDS_SESSION_OPEN) {
> +               if (s->s_state == CEPH_MDS_SESSION_NEW ||
> +                   s->s_state == CEPH_MDS_SESSION_RESTARTING ||
> +                   s->s_state == CEPH_MDS_SESSION_REJECTED)
>                         /* this mds is failed or recovering, just wait */
>                         ceph_put_mds_session(s);
>                         continue;
> --
> 1.8.3.1
>
    Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Jeff Layton Aug. 28, 2019, 2:04 p.m. UTC | #2
On Wed, 2019-08-28 at 21:22 +0800, chenerqi@gmail.com wrote:
> From: Erqi Chen <chenerqi@gmail.com>
> 
> If client mds session is evicted in CEPH_MDS_SESSION_OPENING state,
> mds won't send session msg to client, and delayed_work skip
> CEPH_MDS_SESSION_OPENING state session, the session hang forever.
> ceph_con_keepalive reconnct connection for CEPH_MDS_SESSION_OPENING
> session to avoid session hang.
> 
> Fixes: https://tracker.ceph.com/issues/41551
> Signed-off-by: Erqi Chen chenerqi@gmail.com
> ---
>  fs/ceph/mds_client.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 920e9f0..3d589c0 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -4044,7 +4044,9 @@ static void delayed_work(struct work_struct *work)
>  				pr_info("mds%d hung\n", s->s_mds);
>  			}
>  		}
> -		if (s->s_state < CEPH_MDS_SESSION_OPEN) {
> +		if (s->s_state == CEPH_MDS_SESSION_NEW ||
> +		    s->s_state == CEPH_MDS_SESSION_RESTARTING ||
> +		    s->s_state == CEPH_MDS_SESSION_REJECTED)
>  			/* this mds is failed or recovering, just wait */
>  			ceph_put_mds_session(s);
>  			continue;

This "if" is missing an opening curly brace. I fixed that up and cleaned
up the changelog. I'll merge this into ceph/testing after doing some
tests with it today.

Thanks!

Patch
diff mbox series

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 920e9f0..3d589c0 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -4044,7 +4044,9 @@  static void delayed_work(struct work_struct *work)
 				pr_info("mds%d hung\n", s->s_mds);
 			}
 		}
-		if (s->s_state < CEPH_MDS_SESSION_OPEN) {
+		if (s->s_state == CEPH_MDS_SESSION_NEW ||
+		    s->s_state == CEPH_MDS_SESSION_RESTARTING ||
+		    s->s_state == CEPH_MDS_SESSION_REJECTED)
 			/* this mds is failed or recovering, just wait */
 			ceph_put_mds_session(s);
 			continue;