From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11953C47083 for ; Wed, 2 Jun 2021 22:27:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD308613D4 for ; Wed, 2 Jun 2021 22:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229600AbhFBW26 (ORCPT ); Wed, 2 Jun 2021 18:28:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbhFBW26 (ORCPT ); Wed, 2 Jun 2021 18:28:58 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B647C06174A for ; Wed, 2 Jun 2021 15:27:14 -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=e2ldX4bfM5mKfs85ACVtcDrIKE1liu0rw7NOjjRx7JI=; b=n55GYFH4iUTRiVjGnFSsjozLSu eUh7m9Vo5CXQ/CpjboZJyd+MlP+PLf32oOoain3d29wyV2nXDLZ/tK9wXxLEbPFPKA7owFYShKm+V aECRPoQAHaRz8HTpjY/T+R3GxrSNmAXTPR/HYJ0TkCj09IzviT8WqleeCGGk9s6ENBwl7HRSTs+x/ p72LnLbUwEwsCc/9qarhFz+CL+Hk/CdyqFTpUf95ghtdRsMUeC8v4ATjTP/+9Q45LLTHR9rPoUZ1S 9dbDx2DzBSSwS6gu9LrShZwK0HUuSDQEngIzOqyE3K9RkxQhENXAB23PjeWXAJ9H6bADBH4MyC7dd Iz8+5tRw==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1loZK2-00Bary-S4; Wed, 02 Jun 2021 22:26:52 +0000 Date: Wed, 2 Jun 2021 23:26:46 +0100 From: Matthew Wilcox To: "Darrick J. Wong" Cc: Christoph Hellwig , Dave Chinner , linux-fsdevel , Jeff Layton Subject: Re: question about mapping_set_error when writeback fails? Message-ID: References: <20210602202756.GA26333@locust> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210602202756.GA26333@locust> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed, Jun 02, 2021 at 01:27:56PM -0700, Darrick J. Wong wrote: > In iomap_finish_page_writeback, > > static void > iomap_finish_page_writeback(struct inode *inode, struct page *page, > int error, unsigned int len) > { > struct iomap_page *iop = to_iomap_page(page); > > if (error) { > SetPageError(page); > mapping_set_error(inode->i_mapping, -EIO); > > Why don't we pass error to mapping_set_error here? If the writeback > completion failed due to insufficient space (e.g. extent mapping btree > expansion hit ENOSPC while trying to perform an unwritten extent > conversion) then we set AS_EIO which causes fsync to return EIO instead > of ENOSPC like you'd expect. Hah, I noticed the same thing a few weeks ago and didn't get round to asking about it yet. I'm pretty sure we should pass the real error to mapping_set_error(). I also wonder if we shouldn't support more of the errors from blk_errors, like -ETIMEDOUT or -EILSEQ, but that's a different conversation.