From patchwork Wed Oct 7 12:16:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 268226 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC3E8C4363D for ; Wed, 7 Oct 2020 12:17:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A43332080A for ; Wed, 7 Oct 2020 12:17:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602073029; bh=DM3lhiyb9vtqaeq4r9CabQrC5813XAm1UlasKR7oEX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=O1IbDEzEhLp176jRwvfO/qk1RdL/ohLIa4/T2v8TBmSapH6Pgt/Zy/BoSK2n+dPd6 bHGk54lM77p2jZBu3GomV0/MxAnld0NE7KNZH19Gm2vcykYt8++Kq8S6rZKdPp9Oyu 8kw01HdfLgNi8AdEXRHdjJDr3ies6vXCutgsaD4E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728177AbgJGMRI (ORCPT ); Wed, 7 Oct 2020 08:17:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:41420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727978AbgJGMRH (ORCPT ); Wed, 7 Oct 2020 08:17:07 -0400 Received: from tleilax.com (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7605A20870; Wed, 7 Oct 2020 12:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602073027; bh=DM3lhiyb9vtqaeq4r9CabQrC5813XAm1UlasKR7oEX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aeN0kCc2bp5YQc3DvqeGZhu0C49akP0qSbsd/FVyMHTJ+GCckNwvZogM8nyGiaDbl 2ErkODE3YsaWUSSWIOKdQ8G3zEw9fduo+rMeC6d8kDjtMFn3thkEkduphWzLCfVKGs jvnEPEPbdI7iictlWs1pSaEyOD3BDre5bNhyZVWQ= From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: idryomov@gmail.com, ukernel@gmail.com, pdonnell@redhat.com Subject: [PATCH v4 4/5] ceph: remove timeout on allowing reconnect after blocklisting Date: Wed, 7 Oct 2020 08:16:59 -0400 Message-Id: <20201007121700.10489-5-jlayton@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201007121700.10489-1-jlayton@kernel.org> References: <20201007121700.10489-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org 30 minutes is a long time to wait, and this makes it difficult to test the feature by manually blocklisting clients. Remove the timeout infrastructure and just allow the client to reconnect at will. Signed-off-by: Jeff Layton --- fs/ceph/mds_client.c | 5 ----- fs/ceph/super.h | 1 - 2 files changed, 6 deletions(-) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 91de271d0093..240eee5baa0f 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -4374,12 +4374,7 @@ static void maybe_recover_session(struct ceph_mds_client *mdsc) if (!READ_ONCE(fsc->blocklisted)) return; - if (fsc->last_auto_reconnect && - time_before(jiffies, fsc->last_auto_reconnect + HZ * 60 * 30)) - return; - pr_info("auto reconnect after blocklisted\n"); - fsc->last_auto_reconnect = jiffies; ceph_force_reconnect(fsc->sb); } diff --git a/fs/ceph/super.h b/fs/ceph/super.h index d0cb6a51c6a4..9ced23b092f5 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -108,7 +108,6 @@ struct ceph_fs_client { int mount_state; - unsigned long last_auto_reconnect; bool blocklisted; bool have_copy_from2; From patchwork Wed Oct 7 12:17:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 268225 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF0D6C4363D for ; Wed, 7 Oct 2020 12:17:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68CE2207EA for ; Wed, 7 Oct 2020 12:17:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602073032; bh=91jClrhQPxOGVuFdvLURrWkOc1jDSfgyhsB+GUDZdnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CmpD1B4RMGk78AyP1/wj2p3vGYEW90JmZLsMAqSh8uca58sN1io1xH6MWlZQ8Xt8Z NBUjzIL76q35/Fddc8TrOj+tk1YYlxf3IhluJlfT8DrLrQ0XIcmIKbx1b/daS7Mh8J gNlxpt9b9HJ8u/qyTK2SSU8H1SUNDjoOiu6u8Wdw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728181AbgJGMRL (ORCPT ); Wed, 7 Oct 2020 08:17:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:41428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728167AbgJGMRI (ORCPT ); Wed, 7 Oct 2020 08:17:08 -0400 Received: from tleilax.com (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 35D4220789; Wed, 7 Oct 2020 12:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602073027; bh=91jClrhQPxOGVuFdvLURrWkOc1jDSfgyhsB+GUDZdnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F4EMQF/qllKHukKVt4upRfKNBUKWiSAJuVtpEtXSLrbmgDTO7NoPB9sS4FUD7QhTC GcRzCqNZ3/Thk5S5+cTkITqKFwdMV3N5WqHyYla6fYfdKYNA5/zQE5SvCbHGKAf0el 8jR78NrAWGdnHAV9HUpO7uU5uecSEO1p01j3ANXI= From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: idryomov@gmail.com, ukernel@gmail.com, pdonnell@redhat.com Subject: [PATCH v4 5/5] ceph: queue MDS requests to REJECTED sessions when CLEANRECOVER is set Date: Wed, 7 Oct 2020 08:17:00 -0400 Message-Id: <20201007121700.10489-6-jlayton@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201007121700.10489-1-jlayton@kernel.org> References: <20201007121700.10489-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Ilya noticed that the first access to a blacklisted mount would often get back -EACCES, but then subsequent calls would be OK. The problem is in __do_request. If the session is marked as REJECTED, a hard error is returned instead of waiting for a new session to come into being. When the session is REJECTED and the mount was done with recover_session=clean, queue the request to the waiting_for_map queue, which will be awoken after tearing down the old session. We can only do this for sync requests though, so check for async ones first and just let the callers redrive a sync request. URL: https://tracker.ceph.com/issues/47385 Reported-by: Ilya Dryomov Signed-off-by: Jeff Layton --- fs/ceph/mds_client.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 240eee5baa0f..06f51e76f586 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2818,10 +2818,6 @@ static void __do_request(struct ceph_mds_client *mdsc, ceph_session_state_name(session->s_state)); if (session->s_state != CEPH_MDS_SESSION_OPEN && session->s_state != CEPH_MDS_SESSION_HUNG) { - if (session->s_state == CEPH_MDS_SESSION_REJECTED) { - err = -EACCES; - goto out_session; - } /* * We cannot queue async requests since the caps and delegated * inodes are bound to the session. Just return -EJUKEBOX and @@ -2831,6 +2827,20 @@ static void __do_request(struct ceph_mds_client *mdsc, err = -EJUKEBOX; goto out_session; } + + /* + * If the session has been REJECTED, then return a hard error, + * unless it's a CLEANRECOVER mount, in which case we'll queue + * it to the mdsc queue. + */ + if (session->s_state == CEPH_MDS_SESSION_REJECTED) { + if (ceph_test_mount_opt(mdsc->fsc, CLEANRECOVER)) + list_add(&req->r_wait, &mdsc->waiting_for_map); + else + err = -EACCES; + goto out_session; + } + if (session->s_state == CEPH_MDS_SESSION_NEW || session->s_state == CEPH_MDS_SESSION_CLOSING) { err = __open_session(mdsc, session);