Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1682011ybg; Thu, 4 Jun 2020 16:33:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGjFQHfcBy9pkNM7lzmH/nEBgPZcsl20xm2t3dRxeC5yL6kwxeB6LdOfb175qxRACWwkpm X-Received: by 2002:a17:906:6a4b:: with SMTP id n11mr5806145ejs.198.1591313628744; Thu, 04 Jun 2020 16:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591313628; cv=none; d=google.com; s=arc-20160816; b=hPVVVIoWbqWtI92eYro8tDaBUgLn1jGMyRrEsPDrL01QzqKKKAFPwQ91RmIhetuVj7 diR4/e7NK4W2OJbf2gTmoVDRBeJnzu0jb6mP/p2ovf8w7U5k3/UtEm0d7//XhXnUf/Px tuWdSFDPLdXs6J5MIkb88Ey1lL46IQKXTjY/cPMezsrAus/b24Tt/HB6xgsbWEbT7DY5 +dVhuWUE3fZuxLxP/zY+r9MZGgKeFJ55bIONjRIaByij3H4hUIMhEymPNl1yRsoe7He8 +THc1YXEXSWVgSugdyQKiJXAeDkM2n3IHKYAg85hLsc4JrtcgkWNWztb/o9/2qgaQ4y/ S8ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=YpWnxiB1Og8bCPgM5L4f6O//b2ykky0BFJ1IeUW3XT4=; b=uTmRIRnDeXlD1fIJbg+DqpTQJDzQlkr/QoBexkXzG4LZ4ITxIYQMWxC3ExxTidpqs1 byzWYLSF1mzQ9zEg2HQCPl2qYG72I+gdAJNx/IkfPkqcl8RYkKl7B/HTYhcbglGQ4xZf NWARzIaQxF7cxGuDQNKIFxnaUmCoJqkH3UdVC1l0z5DNE/mNeCC/Q/cEYrBuD/eEftGJ Q3DlJRzWXsl7h4YEJu8dL7srd36fHofxTVF1Mu01KV5B8TDNieIXTRvbCV97jabAC0Xj LjqlEyDIOASWpZeUeEuKT1IsNU26iEHC/FjSjsY8+mrz5yfc3x2PiOQIN4YPMcDD4/wE Pbyg== 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 d16si2413498ejp.131.2020.06.04.16.33.26; Thu, 04 Jun 2020 16:33:48 -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; 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 S1726144AbgFDXa5 (ORCPT + 99 others); Thu, 4 Jun 2020 19:30:57 -0400 Received: from mail110.syd.optusnet.com.au ([211.29.132.97]:48317 "EHLO mail110.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725920AbgFDXa5 (ORCPT ); Thu, 4 Jun 2020 19:30:57 -0400 Received: from dread.disaster.area (pa49-180-124-177.pa.nsw.optusnet.com.au [49.180.124.177]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id A45A6108319; Fri, 5 Jun 2020 09:30:54 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1jgzK1-0001Pa-Ln; Fri, 05 Jun 2020 09:30:53 +1000 Date: Fri, 5 Jun 2020 09:30:53 +1000 From: Dave Chinner To: Matthew Wilcox Cc: Christoph Hellwig , "Darrick J. Wong" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iomap: Handle I/O errors gracefully in page_mkwrite Message-ID: <20200604233053.GW2040@dread.disaster.area> References: <20200604202340.29170-1-willy@infradead.org> <20200604225726.GU2040@dread.disaster.area> <20200604230519.GW19604@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200604230519.GW19604@bombadil.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=X6os11be c=1 sm=1 tr=0 a=k3aV/LVJup6ZGWgigO6cSA==:117 a=k3aV/LVJup6ZGWgigO6cSA==:17 a=kj9zAlcOel0A:10 a=nTHF0DUjJn0A:10 a=JfrnYn6hAAAA:8 a=7-415B0cAAAA:8 a=jINDFZZm4DkczEFURbYA:9 a=CjuIK1q_8ugA:10 a=1CNFftbPRP8L7MoqJWF3:22 a=biEYGPWJfzWAr4FL6Ov7:22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 04, 2020 at 04:05:19PM -0700, Matthew Wilcox wrote: > On Fri, Jun 05, 2020 at 08:57:26AM +1000, Dave Chinner wrote: > > On Thu, Jun 04, 2020 at 01:23:40PM -0700, Matthew Wilcox wrote: > > > From: "Matthew Wilcox (Oracle)" > > > > > > Test generic/019 often results in: > > > > > > WARNING: at fs/iomap/buffered-io.c:1069 iomap_page_mkwrite_actor+0x57/0x70 > > > > > > Since this can happen due to a storage error, we should not WARN for it. > > > Just return -EIO, which will be converted to a SIGBUS for the hapless > > > task attempting to write to the page that we can't read. > > > > Why didn't the "read" part of the fault which had the EIO error fail > > the page fault? i.e. why are we waiting until deep inside the write > > fault path to error out on a failed page read? > > I have a hypothesis that I don't know how to verify. > > First the task does a load from the page and we put a read-only PTE in > the page tables. Then it writes to the page using write(). The page > gets written back, but hits an error in iomap_writepage_map() > which calls ClearPageUptodate(). Then the task with it mapped attempts > to store to it. Sure, but that's not really what I was asking: why isn't this !uptodate state caught before the page fault code calls ->page_mkwrite? The page fault code has a reference to the page, after all, and in a couple of paths it even has the page locked. What I'm trying to understand is why this needs to be fixed inside ->page_mkwrite, because AFAICT if we have to fix this in the iomap code, we have the same "we got handed a bad page by the page fault" problem in every single ->page_mkwrite implementation.... > I haven't dug through what generic/019 does, so I don't know how plausible > this is. # Run fsstress and fio(dio/aio and mmap) and simulate disk failure # check filesystem consistency at the end. I don't think it is mixing buffered writes and mmap writes on the same file via fio. Maybe fsstress is triggering that, but the fsstress workload is single threaded so, again, I'm not sure it will do this. Cheers, Dave. -- Dave Chinner david@fromorbit.com