Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5767934rwd; Wed, 24 May 2023 06:36:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Wwf/LZieav+AabJ/3PEF84MYnTy9eYMqtMpdm3HFBtiWJBd9FDhVZyP8w+8fshuBLMw35 X-Received: by 2002:a05:6a20:3953:b0:10c:2fe0:b3d with SMTP id r19-20020a056a20395300b0010c2fe00b3dmr8745294pzg.33.1684935365720; Wed, 24 May 2023 06:36:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684935365; cv=none; d=google.com; s=arc-20160816; b=oPzX0JKBe96miGUBpJCL+WH+7zMD4byEjkIEVwv8AzORlfN8FIDtsV6XmCaYjkOIdx Vp2H+/XGBuJyQoKZ3sNon77//TlLDuG5qexz2j30ug/4PgJojcU65E+f40e4Svn3T0n3 3X3OCA0kbgexOgSlS5jFP6Sfu95Og5xMgp0anlIMiO0DaI9N/XaqEojUz02hBC4idWRE S1Ku2AXzMFQT6VNHfCoYn8xH40NNcfauuvbKQ7b+kBgKGrcPESryWenQrD/xS4/+w16H fF3nJtet1kIAUlrrAZwQPtjc5owoSMfcpZq4+e7VyCvu6hQytFPKvMmkMeaEEVK/SfBL 52VQ== 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=PlI3NINuTp5y2t5Z+4wg7vfiTt8lvB4SyLbHC5tKASU=; b=VqQuzU5kb87Go9JvZI+gjCkS5Oxr7bYHXLKevxZUnWuf6Ac4kntPqra1smDsLAyFBI o1AYhDq1hXiVHGGBMd8sToOfUa5p8xY1jgxoXtPoXL5993XcoYAZSqBM7Q3vH26WI/lv vQRDqaCne1fWehER/RvKEitCZIsu19AUA5vTL1s1fMil254/IdB7zNdQoNwjfQMWS6jf BuuGd7v921fD2wRlQJZr+jC2tcpyPhyD2g74SEAd2FLrjscuarG1CDPGtmTPCkQLhU3W gwi+74E3FJKRFO31OT0ZRJUiV5oh/aYVnr64JRzudN5Gg615zt0/BDccFWBjLuyKveCb ew4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=eq1oO18n; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-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 g11-20020a63374b000000b005307b843a98si2117431pgn.53.2023.05.24.06.35.47; Wed, 24 May 2023 06:36:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=eq1oO18n; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234371AbjEXNdZ (ORCPT + 99 others); Wed, 24 May 2023 09:33:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230255AbjEXNdY (ORCPT ); Wed, 24 May 2023 09:33:24 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47999A7; Wed, 24 May 2023 06:33: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=PlI3NINuTp5y2t5Z+4wg7vfiTt8lvB4SyLbHC5tKASU=; b=eq1oO18nKmxdfx79+rZ3TTo5Q2 2/F3VHC9ngHsBakNRFv680ymTTyCK9hQMC/hF/6ByoTd1QX5Huc2qSnkfOtIpqNxg3U3KILlEnohH tk1m/vJLtoK5KkcBjlU2kaBM3cLYnmqGoN2Zya9Htl2CZTaH4W94BgkzuYeaOzmShvPd+qb3ym5EL yonGPZiSfd3yzH3hEQFRUsVsx849CuZTYjYDAClbFB7R6Y5PcboAB1JCCXjmLj8dakGubsyS8QwrS jjlaR0JAq6BqcKNmdvnkHdN+wsZcZz5xjzhHDugGtoEqqn7cXDiJJ1Gi7vDVBHa/uqXa8DUbUI1v1 peQuoiEw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1q1oc5-00BF3M-Tz; Wed, 24 May 2023 13:33:13 +0000 Date: Wed, 24 May 2023 14:33:13 +0100 From: Matthew Wilcox To: Dave Chinner Cc: Hannes Reinecke , Christoph Hellwig , Jens Axboe , Miklos Szeredi , "Darrick J. Wong" , Andrew Morton , David Howells , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, ceph-devel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 16/17] block: use iomap for writes to block devices Message-ID: References: <20230424054926.26927-1-hch@lst.de> <20230424054926.26927-17-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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-ext4@vger.kernel.org On Wed, May 24, 2023 at 08:27:13AM +1000, Dave Chinner wrote: > On Fri, May 19, 2023 at 04:22:01PM +0200, Hannes Reinecke wrote: > > I'm hitting this during booting: > > [ 5.016324] > > [ 5.030256] iomap_iter+0x11a/0x350 > > [ 5.030264] iomap_readahead+0x1eb/0x2c0 > > [ 5.030272] read_pages+0x5d/0x220 > > [ 5.030279] page_cache_ra_unbounded+0x131/0x180 > > [ 5.030284] filemap_get_pages+0xff/0x5a0 > > Why is filemap_get_pages() using unbounded readahead? Surely > readahead should be limited to reading within EOF.... It isn't using unbounded readahead; that's an artifact of this incomplete stack trace. Actual call stack: page_cache_ra_unbounded do_page_cache_ra ondemand_readahead page_cache_sync_ra page_cache_sync_readahead filemap_get_pages As you can see, do_page_cache_ra() does limit readahead to i_size. Is ractl->mapping->host the correct way to find the inode? I always get confused. > I think Christoph's code is correct. IMO, any attempt to read beyond > the end of the device should throw out a warning and return an > error, not silently return zeros. > > If readahead is trying to read beyond the end of the device, then it > really seems to me like the problem here is readahead, not the iomap > code detecting the OOB read request.... > > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com