Skip to contentSkip to conversation

zonefs: Call zonefs_io_error() on any error from filemap_splice_read()

PATCH In review David Howells 4 participants 6 messages May 25, 2023 – May 26, 2023

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

PATCH 1/1 zonefs: Call zonefs_io_error() on any error from filemap_splice_read()

Call zonefs_io_error() after getting any error from filemap_splice_read() in zonefs_file_splice_read(), including non-fatal errors such as ENOMEM, EINTR and EAGAIN.

---
 fs/zonefs/file.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/zonefs/file.c +1 -1
index 65d4c4fe6364..0660cffc5ed8 100644
@@ -782,7 +782,7 @@ static ssize_t zonefs_file_splice_read(struct file *in, loff_t *ppos,
 
 	if (len > 0) {
 		ret = filemap_splice_read(in, ppos, pipe, len, flags);
-		if (ret == -EIO)
+		if (ret < 0)
 			zonefs_io_error(inode, false);
 	}
 
#2 lore raw
In reply to David Howells
Quoted 7 lines · David Howells

Call zonefs_io_error() after getting any error from filemap_splice_read() in zonefs_file_splice_read(), including non-fatal errors such as ENOMEM, EINTR and EAGAIN.

This seems like a bizarre thing to do. Let's suppose you got an -ENOMEM. blkdev_report_zones() is also likely to report -ENOMEM in that case, which will cause a zonefs_err() to be called. Surely that can't be the desired outcome from getting -ENOMEM!

maintainer
#3 lore raw
Quoted 6 lines · Matthew Wilcox
Quoted 5 lines · David Howells

Call zonefs_io_error() after getting any error from filemap_splice_read() in zonefs_file_splice_read(), including non-fatal errors such as ENOMEM, EINTR and EAGAIN.

Quoted 7 lines
Quoted 2 lines

This seems like a bizarre thing to do. Let's suppose you got an -ENOMEM. blkdev_report_zones() is also likely to report -ENOMEM in that case, which will cause a zonefs_err() to be called. Surely that can't be the desired outcome from getting -ENOMEM!

Right... What I want to make sure here is that the error we get is not the result of a failed IO. Beside EIO, are there any other cases ?
I can think of at least:
1) -ETIMEDOUT -> the drive is not responding. In this case, calling zonefs_io_error() may not be useful either.
2) -ETIME: The IO was done with a duration limit (e.g. active time limit) and was aborted by the drive because it took too long. Calling zonefs_io_error() for this case is also not useful.

But I am thinking block layer (blk_status_t to errno conversion) here. Does the folio code *always* return EIO if it could not get a page/folio, regardless of the actual bio status ?

Signature · 2 lines
Damien Le Moal
Western Digital Research
maintainer
#4 lore raw
Quoted 24 lines · Damien Le Moal
Quoted 6 lines · Matthew Wilcox
Quoted 5 lines · David Howells

Call zonefs_io_error() after getting any error from filemap_splice_read() in zonefs_file_splice_read(), including non-fatal errors such as ENOMEM, EINTR and EAGAIN.

Quoted 7 lines
Quoted 2 lines

This seems like a bizarre thing to do. Let's suppose you got an -ENOMEM. blkdev_report_zones() is also likely to report -ENOMEM in that case, which will cause a zonefs_err() to be called. Surely that can't be the desired outcome from getting -ENOMEM!

Right... What I want to make sure here is that the error we get is not the result of a failed IO. Beside EIO, are there any other cases ?
I can think of at least:
1) -ETIMEDOUT -> the drive is not responding. In this case, calling zonefs_io_error() may not be useful either.
2) -ETIME: The IO was done with a duration limit (e.g. active time limit) and was aborted by the drive because it took too long. Calling zonefs_io_error() for this case is also not useful.

Quoted 3 lines

But I am thinking block layer (blk_status_t to errno conversion) here. Does the folio code *always* return EIO if it could not get a page/folio, regardless of the actual bio status ?

Replying to myself :)

iomap_read_folio() or iomap_finish_folio_read() -> folio_set_error(), which sets PG_error. Then filemap_read_folio() will see !folio_test_uptodate(folio) and end up returning -EIO. So if there was an IO and it failed, we always get EIO, regardless of the actual reason for the IO failure. Right ?

Signature · 2 lines
Damien Le Moal
Western Digital Research
#5 lore raw
Quoted 4 lines · Damien Le Moal

iomap_read_folio() or iomap_finish_folio_read() -> folio_set_error(), which sets PG_error. Then filemap_read_folio() will see !folio_test_uptodate(folio) and end up returning -EIO. So if there was an IO and it failed, we always get EIO, regardless of the actual reason for the IO failure. Right ?

Don't rely on that. I have plans for returning the correct error.

Really we need a function that knows whether an errno is transient or reportable.