Skip to content

Commit cd3c877

Browse files
Darrick J. Wongbrauner
authored andcommitted
iomap: don't report direct-io retries to fserror
iomap's directio implementation has two magic errno codes that it uses to signal callers -- ENOTBLK tells the filesystem that it should retry a write with the pagecache; and EAGAIN tells the caller that pagecache flushing or invalidation failed and that it should try again. Neither of these indicate data loss, so let's not report them. Fixes: a9d573e ("iomap: report file I/O errors to the VFS") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Link: https://patch.msgid.link/20260224154637.GD2390381@frogsfrogsfrogs Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent d9d32e5 commit cd3c877

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

fs/iomap/direct-io.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,19 @@ static inline enum fserror_type iomap_dio_err_type(const struct iomap_dio *dio)
8787
return FSERR_DIRECTIO_READ;
8888
}
8989

90+
static inline bool should_report_dio_fserror(const struct iomap_dio *dio)
91+
{
92+
switch (dio->error) {
93+
case 0:
94+
case -EAGAIN:
95+
case -ENOTBLK:
96+
/* don't send fsnotify for success or magic retry codes */
97+
return false;
98+
default:
99+
return true;
100+
}
101+
}
102+
90103
ssize_t iomap_dio_complete(struct iomap_dio *dio)
91104
{
92105
const struct iomap_dio_ops *dops = dio->dops;
@@ -96,7 +109,7 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio)
96109

97110
if (dops && dops->end_io)
98111
ret = dops->end_io(iocb, dio->size, ret, dio->flags);
99-
if (dio->error)
112+
if (should_report_dio_fserror(dio))
100113
fserror_report_io(file_inode(iocb->ki_filp),
101114
iomap_dio_err_type(dio), offset, dio->size,
102115
dio->error, GFP_NOFS);

0 commit comments

Comments
 (0)