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 93635C41513 for ; Fri, 11 Aug 2023 12:44:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234961AbjHKMo6 (ORCPT ); Fri, 11 Aug 2023 08:44:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjHKMo6 (ORCPT ); Fri, 11 Aug 2023 08:44:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB52726A0; Fri, 11 Aug 2023 05:44:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7ABAB66F42; Fri, 11 Aug 2023 12:44:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32F6CC433C8; Fri, 11 Aug 2023 12:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691757896; bh=kOskk37y8nZjyvPH/Qy4aWj3xKWEsFGaCCRYUsKR8BI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tgpozOqGErBs+RHwvCOez2p6Wj0ytNS+EC+N+9BSLV60ICVcCocDxl0z+wJPAvD0X 7XmgSNieHweTiVgqDM9iZbdpBMexB9nColFt3UOQJediExKvVTtFzpmI0RBAuHEo3z KJB5gOYHcUYuwQDeI9hBTOkee+ItGCYPBYO7XBAOScSLaRYwwWpGxbNChdAb7iwddY f9iRHRC02rm98JA4ckHaIdKgKspwFFd/2mKsLBUZcy2fTt1JB/ilRJQAiQFnmedc4V M/nsoNhkzuVCxhlK5fWhbPubKKc1KrMrnbF9rP7I5mgvUf+QrP8KklG6WMZdc9NdUd amqoqor2FXzGA== Date: Fri, 11 Aug 2023 14:44:50 +0200 From: Christian Brauner To: Christoph Hellwig Cc: Al Viro , Jens Axboe , Denis Efremov , Josef Bacik , Stefan Haberland , Jan Hoeppner , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , "Darrick J . Wong" , Chris Mason , David Sterba , linux-block@vger.kernel.org, nbd@other.debian.org, linux-s390@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 05/17] btrfs: open block devices after superblock creation Message-ID: <20230811-wildpark-bronzen-5e30a56de1a1@brauner> References: <20230811100828.1897174-1-hch@lst.de> <20230811100828.1897174-6-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230811100828.1897174-6-hch@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Fri, Aug 11, 2023 at 12:08:16PM +0200, Christoph Hellwig wrote: > Currently btrfs_mount_root opens the block devices before committing to > allocating a super block. That creates problems for restricting the > number of writers to a device, and also leads to a unusual and not very > helpful holder (the fs_type). > > Reorganize the code to first check whether the superblock for a > particular fsid does already exist and open the block devices only if it > doesn't, mirroring the recent changes to the VFS mount helpers. To do > this the increment of the in_use counter moves out of btrfs_open_devices > and into the only caller in btrfs_mount_root so that it happens before > dropping uuid_mutex around the call to sget. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner And ofc, would be great to get btrfs reviews.