Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6385239rwl; Mon, 9 Jan 2023 07:44:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXvwKh+nhX7wpuHsuR24WZV4G3pgFlQGPNuIpDRJYqZA+MN+YiDgSXsXCufi0/pyMt6GtPnn X-Received: by 2002:a17:90a:d0c4:b0:226:ad9f:92c6 with SMTP id y4-20020a17090ad0c400b00226ad9f92c6mr19885732pjw.32.1673279062950; Mon, 09 Jan 2023 07:44:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673279062; cv=none; d=google.com; s=arc-20160816; b=PVkHeRQynEIzuLiipHnf+gqGRO0in8beeY0z3C6mW4BSQDqg76DYGklQyuz7WZi0uq kFc9ydXLWNq9ealqVB62FN3ZffnCdUVmdzqEi2SKfyZoKZhoX4cjpReZP8mY+TP+aZ8l jQci9EpOS0xnFBQoYJA7CEtHSkIUJN6iive7Cu2c4hG04pVbo+ZtDSZry9abt5epp5ao hkvwEnLvQht1s6JrNNwKR4u8Y2Fguw3mlRHoVrAPzIRaR9xdTXslD08nuapY8povkKxz mxOq9z8NRZp791j/qrsUnfazWXMma0GO7EufBrmrVqEZYUeMeXy3W8INsTiSVK1LNxYQ cQhg== 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=6o3r2EMyccew4PMHM+hL8pHG/IMPNNpv5+R12jgC6lA=; b=HRvsRM31vSBI1gYA2Kwr7ter5hXZfs3jDKWIEGIy/meq8JSGTZUv9JsEMoVNHZugD4 vr+Xe/gVKonhkN126VhSlUNeVobc2qA4F6YYCS/EIWlJw5595H5KyKiUFbIpK6tNAp3P AA9QftTABiWW8xPpdb3hnvGausWSCxKqo9GVW9eeuBzgckh0pYHiRTxLE8y2U7fwPIU2 vBUhptaZuC7KGpsweVZWdDmHHFNkcPQLnL0SXfnSY/rbLiJIDp7ULVNvpnGg8yvGU7Ez TrEN/QRnbfWtAf7kCenc6fJ7/z5mkUELBovdcRz/2Jo8qLbVHn/kkAkcEgVLOUp6HAS6 CZTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=kRYbhsmU; 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 6-20020a17090a08c600b0020087bc6415si12564291pjn.16.2023.01.09.07.44.16; Mon, 09 Jan 2023 07:44:22 -0800 (PST) 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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=kRYbhsmU; 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 S234578AbjAIPDJ (ORCPT + 53 others); Mon, 9 Jan 2023 10:03:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233236AbjAIPCw (ORCPT ); Mon, 9 Jan 2023 10:02:52 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38E39175A0; Mon, 9 Jan 2023 07:02:51 -0800 (PST) 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=6o3r2EMyccew4PMHM+hL8pHG/IMPNNpv5+R12jgC6lA=; b=kRYbhsmUqtz7MJELa5DMvJ4VzI 6X90lrh3MAb0AIocQDosyWd6xWeVzvyuJrsUYMQztbBYwfsmPXDyS4olyKkeV4RTEuwcqO0Tv8eWe XjEPn1N0fJJo10rKVG6oL/LDCcXf/PL5DEaFhFtXgh6MueLKYg8q/zPjuZBcQVUSgel55zEIY4NYP lotZ+B7P0JsJ+9216Jzf6B/g0gzs+oYAoLkxUeHuwpjQDMzMlbnXhWXdt/9lvnOLcXluRjaZqa7uW PdLuvYrfIhjdjaLwTYqha4g23TN/WXSruYsiK5FgblOwfcP/Ugk6QM4mVBY1WHf5p2fbRCh5fDJJ+ seAPhoAA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEtft-002NKW-SN; Mon, 09 Jan 2023 15:02:57 +0000 Date: Mon, 9 Jan 2023 15:02:57 +0000 From: Matthew Wilcox To: Jeff Layton Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: Re: [PATCH 02/11] filemap: Remove filemap_check_and_keep_errors() Message-ID: References: <20230109051823.480289-1-willy@infradead.org> <20230109051823.480289-3-willy@infradead.org> <36311b962209353333be4c8ceaf0e0823ef9f228.camel@redhat.com> <05df91ed071cfefa272bb8d2fb415222867bae32.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <05df91ed071cfefa272bb8d2fb415222867bae32.camel@redhat.com> 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 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 Mon, Jan 09, 2023 at 09:31:00AM -0500, Jeff Layton wrote: > On Mon, 2023-01-09 at 14:02 +0000, Matthew Wilcox wrote: > > On Mon, Jan 09, 2023 at 08:48:49AM -0500, Jeff Layton wrote: > > > On Mon, 2023-01-09 at 05:18 +0000, Matthew Wilcox (Oracle) wrote: > > > > Convert both callers to use the "new" errseq infrastructure. > > > > > > I looked at making this sort of change across the board alongside the > > > original wb_err patches, but I backed off at the time. > > > > > > With the above patch, this function will no longer report a writeback > > > error that occurs before the sample. Given that writeback can happen at > > > any time, that seemed like it might be an undesirable change, and I > > > didn't follow through. > > > > > > It is true that the existing flag-based code may miss errors too, if > > > multiple tasks are test_and_clear'ing the bits, but I think the above is > > > even more likely to happen, esp. under memory pressure. > > > > > > To do this right, we probably need to look at these callers and have > > > them track a long-term errseq_t "since" value before they ever dirty the > > > pages, and then continually check-and-advance vs. that. > > > > > > For instance, the main caller of the above function is jbd2. Would it be > > > reasonable to add in a new errseq_t value to the jnode for tracking > > > errors? > > > > Doesn't b4678df184b3 address this problem? If nobody has seen the > > error, we return 0 instead of the current value of wb_err, ensuring > > that somebody always sees the error. > > > > I was originally thinking no, but now I think you're correct. > > We do initialize the "since" value to 0 if an error has never been seen, > so that (sort of) emulates the behavior of the existing AS_EIO/AS_ENOSPC > flags. > > It's still not quite as reliable as plumbing a "since" value through all > of the callers (particularly in the case where there are multiple > waiters), but maybe it's good enough here. I actually think we may have the opposite problem; that for some of these scenarios, we never mark the error as seen. ie we always end up calling errseq_check() and never errseq_check_and_advance(). So every time we write something, it'll remind us that we have an error.