Jan Kara <jack@xxxxxxx> writes: > On Tue 19-10-21 17:44:26, Jan Kara wrote: >> On Mon 18-10-21 21:00:13, Gabriel Krisman Bertazi wrote: >> > Send a FS_ERROR message via fsnotify to a userspace monitoring tool >> > whenever a ext4 error condition is triggered. This follows the existing >> > error conditions in ext4, so it is hooked to the ext4_error* functions. >> > >> > It also follows the current dmesg reporting in the format. The >> > filesystem message is composed mostly by the string that would be >> > otherwise printed in dmesg. >> > >> > A new ext4 specific record format is exposed in the uapi, such that a >> > monitoring tool knows what to expect when listening errors of an ext4 >> > filesystem. >> > >> > Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx> >> > Reviewed-by: Theodore Ts'o <tytso@xxxxxxx> >> > Signed-off-by: Gabriel Krisman Bertazi <krisman@xxxxxxxxxxxxx> >> >> Looks good to me. Feel free to add: >> >> Reviewed-by: Jan Kara <jack@xxxxxxx> > > Hum, I actually retract this because the code doesn't match what is written > in the documentation and I'm not 100% sure what is correct. In particular: > >> > @@ -759,6 +760,8 @@ void __ext4_error(struct super_block *sb, const char *function, >> > sb->s_id, function, line, current->comm, &vaf); >> > va_end(args); >> > } >> > + fsnotify_sb_error(sb, NULL, error); >> > + > > E.g. here you pass the 'error' to fsnotify. This will be just standard > 'errno' number, not ext4 error code as described in the documentation. Also > note that frequently 'error' will be 0 which gets magically transformed to > EFSCORRUPTED in save_error_info() in the ext4 error handling below. So > there's clearly some more work to do... Nice catch. The many 0 returns were discussed before, around v3. You can notice one of my LTP tests is designed to catch that. We agreed ext4 shouldn't be returning 0, and that we would write a patch to fix it, but I didn't think it belonged as part of this series. You are also right about the EXT4_ vs. errno. the documentation is buggy, since it was brought from the fs-specific descriptor days, which no longer exists. Nevertheless, I think there is a case for always returning file system specific errors here, since they are more descriptive. Should we agree to follow the documentation and return FS specific errors instead of errno, then? Either way, I'm dropping all r-by flags here. -- Gabriel Krisman Bertazi