From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DD02C7EE23 for ; Thu, 1 Jun 2023 09:46:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232958AbjFAJqq (ORCPT ); Thu, 1 Jun 2023 05:46:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232994AbjFAJqa (ORCPT ); Thu, 1 Jun 2023 05:46:30 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDE72198; Thu, 1 Jun 2023 02:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=U4TjS8hJ35XHd5owLFnLOorlk910Gs34ZQ7m5GZkWrQ=; b=AW37rgIICwNhWS4cQhU/rOeDtl Fc+pKGDwxbMkx0yfrdUfBJETxBAGp2L+FpFX21n05hR40fvZFcvzDwgR4mGclRFIE0HiYAjcr84Mo 2LguJIqCn1sSXXNeRICc/NGz2FRZLPnp/I0ODyqo7Oe3SMAk+CHWSOO9s6xFUWX/RFJRVNFST7RZz WHd/zUQlxakpP9Hs7BFtLb2QUJfHzuBZKfb3uvWFLfFd0glBqTLYSvVh9VN/6S3U3R/flIWQrusGK GzQjiph+NDLg5nzUpREgxdrrLcFZ0C+H657sG2nQdU+xdso6RQIUhbYoqnqINKLbB91BaIeD7V0wP h513/YCA==; Received: from [2001:4bb8:182:6d06:35f3:1da0:1cc3:d86d] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q4et1-002mEa-0r; Thu, 01 Jun 2023 09:46:27 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Al Viro , Christian Brauner , "Darrick J. Wong" , Jan Kara , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH 16/16] ext4: wire up the ->mark_dead holder operation for log devices Date: Thu, 1 Jun 2023 11:44:59 +0200 Message-Id: <20230601094459.1350643-17-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601094459.1350643-1-hch@lst.de> References: <20230601094459.1350643-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Implement a set of holder_ops that shut down the file system when the block device used as log device is removed undeneath the file system. Signed-off-by: Christoph Hellwig --- fs/ext4/super.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index a177a16c4d2fe5..9070ea9154d727 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1096,6 +1096,15 @@ void ext4_update_dynamic_rev(struct super_block *sb) */ } +static void ext4_bdev_mark_dead(struct block_device *bdev) +{ + ext4_force_shutdown(bdev->bd_holder, EXT4_GOING_FLAGS_NOLOGFLUSH); +} + +static const struct blk_holder_ops ext4_holder_ops = { + .mark_dead = ext4_bdev_mark_dead, +}; + /* * Open the external journal device */ @@ -1104,7 +1113,7 @@ static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb) struct block_device *bdev; bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, sb, - NULL); + &ext4_holder_ops); if (IS_ERR(bdev)) goto fail; return bdev; -- 2.39.2