Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1376069pxb; Fri, 1 Apr 2022 11:39:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXdx3QrwN3jvCyXL2aeOVOISviqiGMVqqeJQ1nBO/CYeuxmZXYSlpx4xWgBI+g1lkUQ73I X-Received: by 2002:a05:6402:b63:b0:419:2d75:de88 with SMTP id cb3-20020a0564020b6300b004192d75de88mr22151568edb.389.1648838378591; Fri, 01 Apr 2022 11:39:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648838378; cv=none; d=google.com; s=arc-20160816; b=J5FLSDt/FnQMKhFNfzlukMrp4TYj/6aRo1Gg+JWAeFbkLZOnPyyTsxQR0i8nmZEa8P 6L08TjU2RpErDZZaFP9r3HmF6qOPczUnKkZy9rqLy95E3a9zKsF34uMKTwAI1rURsG6u WBX1dUXpitAGUwkzTt3Ff0QIZk0yaK7lbrxemLjq2sLy2KKUTDQMavYK7lsMVZZLyu15 OwL6sDaU6bPr6jsWYqta1QqYoH8MefPiA2VrFyXdn82kWbfz96u/tCve/VEI9nvUGgT2 QuLXCslVdBX8DEPSglHRoT8zZRzQ4BscyXyq/ZrF2SBOSp3W3/FU4GP9kJ/EXpYrBKLn 0x0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=lwHGf3npopLitKNPJn5ou770MbCxQHL3GT4SfQLArOY=; b=LEAxKs+2DOF6EEB2SA/gVWvK8kpiQVMysb80/o5afS2sV+HNLI0J8dg9JXvs4oiPPT 24lhVibZnjttj3bvd5E2cLGntWhRFM2mJNEmefXrbY4b/xYcyPqSlBv89PFytzH4Vx+d Z2vVa+MzvPlUzCy1T/5W4k7CdRV/BX0lU59gRhDo0O/Ikz1zPNHDdo+cPwxw1dEbD9FV FF9Ij5fDjmz15a3f6tRCA+30iFlYcuCfVpKCRSQpSKe60olT7hTVST21xgs8tOyUj3De CP6/lzAAZ6Ttnpcd8WY4uR0v+ABruSQMCFiFE9xxWHdNRb51rGiHsqO8N2xAmMnTjOBw Y41w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w22-20020aa7cb56000000b00418c2b5be29si2282673edt.267.2022.04.01.11.39.12; Fri, 01 Apr 2022 11:39:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244928AbiDAE7J (ORCPT + 99 others); Fri, 1 Apr 2022 00:59:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244906AbiDAE7H (ORCPT ); Fri, 1 Apr 2022 00:59:07 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51A63AF1E5; Thu, 31 Mar 2022 21:57:18 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id D5FF268AFE; Fri, 1 Apr 2022 06:57:13 +0200 (CEST) Date: Fri, 1 Apr 2022 06:57:13 +0200 From: Christoph Hellwig To: Marek Szyprowski Cc: Christoph Hellwig , Jens Axboe , Coly Li , Mike Snitzer , Song Liu , "Martin K. Petersen" , Josef Bacik , David Sterba , Phillip Lougher , linux-block@vger.kernel.org, dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: Re: [PATCH 4/5] block: turn bio_kmalloc into a simple kmalloc wrapper Message-ID: <20220401045713.GA9057@lst.de> References: <20220308061551.737853-1-hch@lst.de> <20220308061551.737853-5-hch@lst.de> <6696cc6a-3e3f-035e-5b8c-05ea361383f3@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6696cc6a-3e3f-035e-5b8c-05ea361383f3@samsung.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 31, 2022 at 11:18:03PM +0200, Marek Szyprowski wrote: > Hi Christoph, > > On 08.03.2022 07:15, Christoph Hellwig wrote: > > Remove the magic autofree semantics and require the callers to explicitly > > call bio_init to initialize the bio. > > > > This allows bio_free to catch accidental bio_put calls on bio_init()ed > > bios as well. > > > > Signed-off-by: Christoph Hellwig > > This patch, which landed in today's next-20220331 as commit 57c47b42f454 > ("block: turn bio_kmalloc into a simple kmalloc wrapper"), breaks badly > all my test systems, which use squashfs initrd: In addition to the revert, this is the patch I had already queued up: diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c index 930eb530fa622..fed99bb3df3be 100644 --- a/fs/squashfs/block.c +++ b/fs/squashfs/block.c @@ -72,6 +72,13 @@ static int copy_bio_to_actor(struct bio *bio, return copied_bytes; } +static void squashfs_bio_free(struct bio *bio) +{ + bio_free_pages(bio); + bio_uninit(bio); + kfree(bio); +} + static int squashfs_bio_read(struct super_block *sb, u64 index, int length, struct bio **biop, int *block_offset) { @@ -118,9 +125,7 @@ static int squashfs_bio_read(struct super_block *sb, u64 index, int length, return 0; out_free_bio: - bio_free_pages(bio); - bio_uninit(bio); - kfree(bio); + squashfs_bio_free(bio); return error; } @@ -183,8 +188,7 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length, data = bvec_virt(bvec); length |= data[0] << 8; } - bio_free_pages(bio); - bio_put(bio); + squashfs_bio_free(bio); compressed = SQUASHFS_COMPRESSED(length); length = SQUASHFS_COMPRESSED_SIZE(length); @@ -217,8 +221,7 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length, } out_free_bio: - bio_free_pages(bio); - bio_put(bio); + squashfs_bio_free(bio); out: if (res < 0) { ERROR("Failed to read block 0x%llx: %d\n", index, res);