From patchwork Thu Aug 5 21:31:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12422179 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=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 2ED49C4338F for ; Thu, 5 Aug 2021 21:32:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09EBF60F42 for ; Thu, 5 Aug 2021 21:32:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbhHEVcT (ORCPT ); Thu, 5 Aug 2021 17:32:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:34998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbhHEVcS (ORCPT ); Thu, 5 Aug 2021 17:32:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C852360F42; Thu, 5 Aug 2021 21:31:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628199114; bh=Wyk7Su3mF1TKbpeQGVinnLwDNpQkKT/p9ReSRZ7PDX8=; h=Date:From:To:Cc:Subject:From; b=qBAPFZuJwLV/XyEe7Wf+nZF+dhFA4d8ap3Dksfsl1z1vkMEL78iNEmGKNUG+I0iUn 8DGF3Bnb6R06B1t2eY+FiajYhPEa0pl8pTbZfnyPcBPTWmCE9wKjM+b6Lf3XA7bhG0 4/30STapcd8SVTSd3qkpYmPL8spio7D6coWNjSp8DEgkddphusOYNEPacdG7Z8Jj0q ecA1M08xj/63m5ZIigawKRZja1yPlzDaEgzZVYhuyGwa6Q3B8FrjuZadZvYWoT4mKF hhloptW7oSCVGs+fKaX1inkRzi8pKxwi6teUb4kL8OrzImWDwm461Aez8BuvxKbQ6w xtgBfJLgUQ+FA== Date: Thu, 5 Aug 2021 14:31:54 -0700 From: "Darrick J. Wong" To: linux-fsdevel Cc: Matthew Wilcox , Christoph Hellwig Subject: [PATCH] iomap: pass writeback errors to the mapping Message-ID: <20210805213154.GZ3601443@magnolia> MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Darrick J. Wong Modern-day mapping_set_error has the ability to squash the usual negative error code into something appropriate for long-term storage in a struct address_space -- ENOSPC becomes AS_ENOSPC, and everything else becomes EIO. iomap squashes /everything/ to EIO, just as XFS did before that, but this doesn't make sense. Fix this by making it so that we can pass ENOSPC to userspace when writeback fails due to space problems. Signed-off-by: Darrick J. Wong Reviewed-by: Matthew Wilcox (Oracle) --- fs/iomap/buffered-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 87ccb3438bec..b06138c6190b 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1016,7 +1016,7 @@ iomap_finish_page_writeback(struct inode *inode, struct page *page, if (error) { SetPageError(page); - mapping_set_error(inode->i_mapping, -EIO); + mapping_set_error(inode->i_mapping, error); } WARN_ON_ONCE(i_blocks_per_page(inode, page) > 1 && !iop);