iomap: pass writeback errors to the mapping
authorDarrick J. Wong <djwong@kernel.org>
Wed, 11 Aug 2021 01:32:55 +0000 (18:32 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 16 Aug 2021 19:12:52 +0000 (12:12 -0700)
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 <djwong@kernel.org>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
fs/iomap/buffered-io.c

index 586d9d078ce10e12284f4d7ee5d63f801e38d207..43b9354bac3abdf6465a3d75604b9ad9a464a7b9 100644 (file)
@@ -1026,7 +1026,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);