diff mbox series

iomap: pass writeback errors to the mapping

Message ID 20210805213154.GZ3601443@magnolia (mailing list archive)
State New, archived
Headers show
Series iomap: pass writeback errors to the mapping | expand

Commit Message

Darrick J. Wong Aug. 5, 2021, 9:31 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

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>
---
 fs/iomap/buffered-io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Matthew Wilcox (Oracle) Aug. 5, 2021, 10:12 p.m. UTC | #1
On Thu, Aug 05, 2021 at 02:31:54PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> 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>

I could have sworn I sent this patch in earlier.  Anyway,

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Darrick J. Wong Aug. 9, 2021, 11:35 p.m. UTC | #2
On Thu, Aug 05, 2021 at 11:12:39PM +0100, Matthew Wilcox wrote:
> On Thu, Aug 05, 2021 at 02:31:54PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > 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>
> 
> I could have sworn I sent this patch in earlier.  Anyway,
> 
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

It was an RFC that I then forgot about for a while.  I'll stuff this in
the iomap for-next branch the next time I do an update, which ... let's
see where the iomap iter series goes, review-wise.

--D
diff mbox series

Patch

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);