Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp692295pxb; Mon, 25 Oct 2021 16:45:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQpTG/HV9lZW5M1uKApaOL1ANdW22fJQN6VDI8i3MQd95xOT4sI3JxWwBoTCXxICPhnUJA X-Received: by 2002:aa7:c0cd:: with SMTP id j13mr28797960edp.65.1635205537186; Mon, 25 Oct 2021 16:45:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635205537; cv=none; d=google.com; s=arc-20160816; b=0sUzzX4yRXa9fkeOFsz1p2dTglyCg7APTiqG17aJNXf+ehjIhf8vUaA9hm48c8SonU JtgNNYKpV2dg4RgMCrPgNiZug/aiRIFveeGgFZFkJCSZOxozyQxAvBGswHGBMvOpRp1f eg2UhLfD1/DHKwBNrCjEWfErHA7y94NqJG9/pJjEHx4CCUe5mu2tmCPnNzwf02G/NdwF F91TZkfjmR0jbeGODHYRJ093FhU5tckGcj6+c7Ca6AwfTs0vcmOTcMok2gvZCVNAIfRE j05WnLHYdQC4D+exUp1QSF+s1XI0+eKQmlLDmn1j32d2SvREioOi4xhU56FYcGuqNObk cwOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ue4W1Zsal2RoelgEqFTCjHjLwEsA9tYTOFgrJ7WovkY=; b=B05c+2FCYbEkVDFuGF6bxixicasnZetm8AXtEaa0xOdCkXsiNWik2YgRWISc3aSr57 NUeDS8PPoS5cx4WJ66nTeysxEg/aRDyO6rx1SpW6uc1O6GgwzuwEgd89J/0m5NzMisxK VHb4bIVVNvN8xFYXueau4rHLjD+1mOh+MIh1xKlJOINDSNiQso3oXt31acFIRrZs2c1c IYWO135omthuGrc6RDQTeu1qId5jlJjzpl4kdVPW4KXOJdpkHfNsV/eKDzx/EK+KXQMN XIsROqtwIImnsG/ysUDxVjC4Ki0uf+OHu+vHtbF971rhZQvsWaytYPROMUkBNQ+mebAp gLBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CpID+sPx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o8si23164006ejy.317.2021.10.25.16.45.14; Mon, 25 Oct 2021 16:45:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CpID+sPx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236627AbhJYTlg (ORCPT + 99 others); Mon, 25 Oct 2021 15:41:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:53594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236626AbhJYTfA (ORCPT ); Mon, 25 Oct 2021 15:35:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4F90A6112D; Mon, 25 Oct 2021 19:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635190308; bh=9CT/HiCubkkb1tkOj9ECpsS+ed/U6NE4FYEa6ON9Qco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CpID+sPxNKVAwdUg6feoy3dqdbWN0Qj4Kw0DTrrZ/LhwXvVRkijoDwQqHjB9vAlFv 6Z5HJZocUrTFcvxZYfMLkNCKvu0LlTsNgp7TVFcOrHkXTSTCqljclbp3oBMMH+jma3 t4J/ciFsOvUsPib/+fSpnn1Hck26QncU9rdAnKLM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , Xiubo Li , Ilya Dryomov Subject: [PATCH 5.10 43/95] ceph: skip existing superblocks that are blocklisted or shut down when mounting Date: Mon, 25 Oct 2021 21:14:40 +0200 Message-Id: <20211025191002.968302405@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190956.374447057@linuxfoundation.org> References: <20211025190956.374447057@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeff Layton commit 98d0a6fb7303a6f4a120b8b8ed05b86ff5db53e8 upstream. Currently when mounting, we may end up finding an existing superblock that corresponds to a blocklisted MDS client. This means that the new mount ends up being unusable. If we've found an existing superblock with a client that is already blocklisted, and the client is not configured to recover on its own, fail the match. Ditto if the superblock has been forcibly unmounted. While we're in here, also rename "other" to the more conventional "fsc". Cc: stable@vger.kernel.org URL: https://bugzilla.redhat.com/show_bug.cgi?id=1901499 Signed-off-by: Jeff Layton Reviewed-by: Xiubo Li Reviewed-by: Ilya Dryomov Signed-off-by: Ilya Dryomov Signed-off-by: Greg Kroah-Hartman --- fs/ceph/super.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -997,16 +997,16 @@ static int ceph_compare_super(struct sup struct ceph_fs_client *new = fc->s_fs_info; struct ceph_mount_options *fsopt = new->mount_options; struct ceph_options *opt = new->client->options; - struct ceph_fs_client *other = ceph_sb_to_client(sb); + struct ceph_fs_client *fsc = ceph_sb_to_client(sb); dout("ceph_compare_super %p\n", sb); - if (compare_mount_options(fsopt, opt, other)) { + if (compare_mount_options(fsopt, opt, fsc)) { dout("monitor(s)/mount options don't match\n"); return 0; } if ((opt->flags & CEPH_OPT_FSID) && - ceph_fsid_compare(&opt->fsid, &other->client->fsid)) { + ceph_fsid_compare(&opt->fsid, &fsc->client->fsid)) { dout("fsid doesn't match\n"); return 0; } @@ -1014,6 +1014,17 @@ static int ceph_compare_super(struct sup dout("flags differ\n"); return 0; } + + if (fsc->blocklisted && !ceph_test_mount_opt(fsc, CLEANRECOVER)) { + dout("client is blocklisted (and CLEANRECOVER is not set)\n"); + return 0; + } + + if (fsc->mount_state == CEPH_MOUNT_SHUTDOWN) { + dout("client has been forcibly unmounted\n"); + return 0; + } + return 1; }