Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp724553pxb; Mon, 25 Oct 2021 17:30:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvyD10kuVX7rICcNEa5YLu+NjbAxcWMNERy/frJl1MzI9/svnv+rvsG+wptW5o1aG5xvKK X-Received: by 2002:a63:7e48:: with SMTP id o8mr16494800pgn.157.1635208239625; Mon, 25 Oct 2021 17:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635208239; cv=none; d=google.com; s=arc-20160816; b=lOtGk/HsD/FYyHz37XYBWkN03k8WtXOAtBgMaDTF9E8cPIGnkg4PtmnWPil/7CpZBy LQ155aOknqsOXXlpfEDAdc43jkurTCvuS1H2+w5Ujgm8q0+EK1Oy/P4sY4EhNWzTa5fv Wqz7FHL/+X8BmgTlmCIPITM8VflGOqf6Dr0jhw0kimHlBgUnYQmmieZ/x/FsrPP6TvO+ OqglVdCUP7uoAhLSvKl+KqLP00ud61MOzNUF+iLCrM8/x9LyO5uDW/0iJIfahA505Z0z fHVComq2qEPWPo9SHFL1p+ZjRihq3iREj5X+kuKVJDJs58RqlH+sFhbbUZyUlmbzOMyg uuqw== 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=X61T/GAegszGF8gXqt/xqMaZr0vZgvodVlJra6X3tY0=; b=eSjKhHPBhkR4zChr5pVNenvsOWzFgJ8puQSUGNhS/LbTYLxa8bJ+T7HyTDplIsUEOW sV2BJyDTYNJimsnxey97tNirK9cJ2j3jQVTCo8CTI34a7lwounhjoIS41WLASNALMD2o f7GwTlIoBLLix4WOtEBat9kzOByX2qAmznugR5ttENgV338x6p8plObsam4K84pwChsY WahI6z61K+BY4I29R+bYTesCtRqCrvp5kTuipe1HHeT7UjeLhOjeCf0OvKgdDuCm/2NL dKsnsowc6n+ZO9ggH4ojsAG2F/sqL9k6bE/0GydlElLheqyijFx2a3PHXtIk4UKI4G+m Xbbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n5lZ+R7h; 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 m9si25528662pgv.403.2021.10.25.17.30.26; Mon, 25 Oct 2021 17:30:39 -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=n5lZ+R7h; 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 S237237AbhJYTwv (ORCPT + 99 others); Mon, 25 Oct 2021 15:52:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:38050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237965AbhJYTq6 (ORCPT ); Mon, 25 Oct 2021 15:46:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F26786120E; Mon, 25 Oct 2021 19:40:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635190806; bh=/YRoqzAEjhqmH41n4WgUHDjAzeCTyP7Vgj9LLACY508=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n5lZ+R7hDC8+e8SOQiTX4cq9M2UrtkauMzXLN+z7e8MXsl4yXzz4VkONvrZpcdrny hWv6QGDkK/W+9GxNOJ/ukHG859ecWF40ZxoDE/0ndCj5EPxHl+1lrhFcg1uM1IrBtV k/7tmh2mpMWtCZcHFDO2JiCLUzsULVLiPl29BRUg= 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.14 075/169] ceph: skip existing superblocks that are blocklisted or shut down when mounting Date: Mon, 25 Oct 2021 21:14:16 +0200 Message-Id: <20211025191026.897533379@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025191017.756020307@linuxfoundation.org> References: <20211025191017.756020307@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 @@ -1002,16 +1002,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; } @@ -1019,6 +1019,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; }