Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2155370pxj; Thu, 20 May 2021 01:07:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvHzKYG5wS0DU52jTiVqQEthqAOzPmUr26rw9PEaRdCZe2e0d6+hOw/4wF8OM7b2zpYXWp X-Received: by 2002:a17:906:5291:: with SMTP id c17mr3305810ejm.527.1621498071721; Thu, 20 May 2021 01:07:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621498071; cv=none; d=google.com; s=arc-20160816; b=bPi9DuJwuRuyTFhsltV/6Uh2gwqtcymiFiE40BlwKSOjYRpT7NMbfMJRE4KyAEQgLb yhD+d4Xu6MN3VLUKNwMujYLoX/boK+31B6Aq7Hb3uDJ7pDSmTbrhOxXrW4deFlvN130z EtfjVtCJ7oe1A6zOtyiiJvWLAdKcGGNgYrhFbuVjcYxsF+NRsDLmWmD2f9xGPWxvf/Or kX2VRgyFbI0PYoNLXOHKnTNsPn+68MZ5FIN8pOS1l+QguvXwIqigBk8zf3kk17zr07cQ rQlflybx59Pk0tqFx55qUsaYKv/k/NjTzGi05YNxwQuIGtfx2KSSngaH42T93TDwtMd8 IaZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EnMP33KD+v1NrZLekTHVvqXVLcSZIAG5TyluA2WJ8xo=; b=BhXsrCMcA28stdv1hGhlTbKKGCZSAG6Hl9awBngkkwn4iPBozKMbYhkn/Gat6j8qYZ AnOd+HlYLC/gy7FezVUFlPEa6nFHNMTvrN+tt/mH+seud5X82IQzAhehxPBP1iZ/1VuX p9y3OYU8x80I2dkAMHugKhIQmAM/vIuhjwdn/LevzsTJ7fOh7SYBJFl+TaiQdcrZJAbk s3+PS/6Tbet4bEJDQXsXXW2uS1kpZHVG1L+s5GSPzynabWL2FwFxvSGzc700i69deYvt Eak6fm+Vo5zTTuPewzFFx/ZkGxdIUk8eFJiz6us91EUfIws6+yUCH9bQkQ4iYv5GtWAn YucA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=VBOQN5YQ; 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 d2si1915103ejr.606.2021.05.20.01.07.24; Thu, 20 May 2021 01:07:51 -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=@infradead.org header.s=casper.20170209 header.b=VBOQN5YQ; 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 S230440AbhETIHs (ORCPT + 99 others); Thu, 20 May 2021 04:07:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229953AbhETIHo (ORCPT ); Thu, 20 May 2021 04:07:44 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0571C061574; Thu, 20 May 2021 01:06:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=EnMP33KD+v1NrZLekTHVvqXVLcSZIAG5TyluA2WJ8xo=; b=VBOQN5YQLqy9hFu1pzd15ldk0y iAt19jFhSEpbvZ1+Q5i649CVOMlTcX4wJFDz0K2mS6FalkPvOwtApOyYYTE6ztaWgacQD5nXnK8WP xKZpNhvwKwiNHg8tWrb3zJvmOcHGoplx2s1DbyJrkQMrDGizj50ZiK0jcODlFJuasSrlrGz9Fobyj iZ5z2jSSyGMJzyaephsd/TyQWpDQShzjsf51XJ6PjHFoLQBPdYsBu2K8u8mdfrvbcR0A9VurYVnQc HmwYVZHicIjB2xZjcen1GpH2xP3B65fgz6pQJIymEoDFwumw8YBsiCpD4qnplFzTGb0KxLz6L7Rx1 09J8yQjw==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1ljdg5-00FiuP-QZ; Thu, 20 May 2021 08:05:38 +0000 Date: Thu, 20 May 2021 09:05:09 +0100 From: Christoph Hellwig To: colyli@suse.de Cc: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Diego Ercolani , Jan Szubiak , Marco Rebhan , Matthias Ferdinand , Thorsten Knabe , Victor Westerhuis , Vojtech Pavlik , stable@vger.kernel.org, Takashi Iwai , Kent Overstreet Subject: Re: [PATCH v3] bcache: avoid oversized read request in cache missing code path Message-ID: References: <20210518110009.11413-1-colyli@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210518110009.11413-1-colyli@suse.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This fix is pretty gross. Adding pages to bios can fail for all kinds of reasons, so the fix is to use bio_add_page and check its return value, and if it needs another bio keep looping and chaining more bios. And maybe capping the readahead to some sane upper bound still makes sense, but it should never look at BIO_MAX_VECS for that.