Skip to contentSkip to conversation

iomap: pass writeback errors to the mapping

PATCH In review Darrick J. Wong 2 participants 3 messages Aug 5, 2021 – Aug 9, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iomap: pass writeback errors to the mapping

From: Darrick J. Wong <[email protected]>

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.

---
 fs/iomap/buffered-io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/iomap/buffered-io.c +1 -1
index 87ccb3438bec..b06138c6190b 100644
@@ -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);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

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.

Quoted 4 lines

Fix this by making it so that we can pass ENOSPC to userspace when writeback fails due to space problems.

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

#2 lore raw
Quoted 9 lines · Matthew Wilcox
Quoted 8 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

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.

Quoted 8 lines
Quoted 4 lines

Fix this by making it so that we can pass ENOSPC to userspace when writeback fails due to space problems.

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

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