Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2161206pxb; Mon, 22 Feb 2021 23:13:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTPfpOvBJY5jZ3bahEVsnl2Fxf/hhQDJVIHzcQdc1P8Rd8d9WQhK8Ok5h1Xhrte76hULio X-Received: by 2002:a17:906:6087:: with SMTP id t7mr25081497ejj.90.1614064429203; Mon, 22 Feb 2021 23:13:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614064429; cv=none; d=google.com; s=arc-20160816; b=Y67uSRPf9gvEkbILG9HpdkOKt4qO+zW+BKS/v3b+8OPBvXP31j6z1tC+UJu2abmU/I N48wF0xW04iU4gF+KVOaXMmvIg5+/gSFiXW7/TSk3bMsqCBlu5t64YosdcYYzWXk2+IN pKJag8jbyDGPZJeZM6SEQNWkSvNKrxQCHr5uP+IFfqAWaRLbzfw/uYLrALPTO6nSHJ9s o1KeZttgVdRphWBbXm6vtqqqhdFghREe18lYHGc1AEpEK5HTtL/6uvCtAdkNni2mlTMX mbf2v+tvp6TntnMqcEyIXajlbpwYmHSqZiOlRWKBRya2n6BRNeJAwRL9UElhI+sh37jI 4BFw== 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=n4PxQK55EtTguaK6m3Wp6Yo648MFB0JCoXGQxXHGg68=; b=EcrmbvSkgkrmxFKAFnZAHxW5e1gFtiVEE5tiHQvh1UOCme+lBgK6eVsgRK9CBpEveY MRGSUcKMcDVXo4rIqUEbwCPjK+MALUsjcVNYEc8XlZkqieQsx8TSStxOmm5rpoCj6Xgn rAs5yUJ4s4yGN2YKjNSPZDwowFnddX3HXqONtXAkN0J7ftGAAqmyjqVxpjpC3IxEBMr5 yL1FQFV/F8cjqyHyWH9b6XErHh2MQZ+Uh08ICKawgFxFrg6tQoiX1nfFraOPJyxkbWac gdtqHtg+KSyI3wtXzsEGAshkC6knhhGGP/Zb52iflrlz/YFT70evT9gcYN4wNxyzp79k tR2g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j15si12926661eds.301.2021.02.22.23.13.25; Mon, 22 Feb 2021 23:13:49 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231664AbhBWHLb (ORCPT + 99 others); Tue, 23 Feb 2021 02:11:31 -0500 Received: from verein.lst.de ([213.95.11.211]:32946 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbhBWHLY (ORCPT ); Tue, 23 Feb 2021 02:11:24 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 7CDF168D0D; Tue, 23 Feb 2021 08:10:41 +0100 (CET) Date: Tue, 23 Feb 2021 08:10:40 +0100 From: Christoph Hellwig To: Chaitanya Kulkarni Cc: Christoph Hellwig , John Stultz , Johannes Thumshirn , Damien Le Moal , Jens Axboe , David Anderson , Alistair Delva , Todd Kjos , Amit Pundir , YongQin Liu , lkml , "linux-block@vger.kernel.org" Subject: Re: [REGRESSION] "split bio_kmalloc from bio_alloc_bioset" causing crash shortly after bootup Message-ID: <20210223071040.GB16980@lst.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 23, 2021 at 03:51:23AM +0000, Chaitanya Kulkarni wrote: > Looking at the other call sites do we need something like following ? > Since __blk_queue_bounce() passes the NULL for the passthru case as a > bio_set value ? Well, that is a somewhat odd calling convention. What about the patch below instead? That being we really need to kill this bouncing code off.. diff --git a/block/bounce.c b/block/bounce.c index fc55314aa4269a..789fbcacb1e92a 100644 --- a/block/bounce.c +++ b/block/bounce.c @@ -214,9 +214,9 @@ static void bounce_end_io_read_isa(struct bio *bio) __bounce_end_io_read(bio, &isa_page_pool); } -static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask, - struct bio_set *bs) +static struct bio *bounce_clone_bio(struct bio *bio_src, bool passthrough) { + unsigned int nr_vecs = bio_segments(bio_src); struct bvec_iter iter; struct bio_vec bv; struct bio *bio; @@ -242,8 +242,10 @@ static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask, * asking for trouble and would force extra work on * __bio_clone_fast() anyways. */ - - bio = bio_alloc_bioset(gfp_mask, bio_segments(bio_src), bs); + if (passthrough) + bio = bio_kmalloc(GFP_NOIO, nr_vecs); + else + bio = bio_alloc_bioset(GFP_NOIO, nr_vecs, &bounce_bio_set); if (!bio) return NULL; bio->bi_bdev = bio_src->bi_bdev; @@ -269,11 +271,11 @@ static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask, break; } - if (bio_crypt_clone(bio, bio_src, gfp_mask) < 0) + if (bio_crypt_clone(bio, bio_src, GFP_NOIO) < 0) goto err_put; if (bio_integrity(bio_src) && - bio_integrity_clone(bio, bio_src, gfp_mask) < 0) + bio_integrity_clone(bio, bio_src, GFP_NOIO) < 0) goto err_put; bio_clone_blkg_association(bio, bio_src); @@ -313,8 +315,7 @@ static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig, submit_bio_noacct(*bio_orig); *bio_orig = bio; } - bio = bounce_clone_bio(*bio_orig, GFP_NOIO, passthrough ? NULL : - &bounce_bio_set); + bio = bounce_clone_bio(*bio_orig, passthrough); /* * Bvec table can't be updated by bio_for_each_segment_all(),