diff options
author | Josef Bacik <josef@toxicpanda.com> | 2020-07-21 11:24:28 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-07-27 12:55:46 +0200 |
commit | 59131393434b49a313cfeb11ae880e13149d13b6 (patch) | |
tree | 9e5e3138bc77a37aedd570cec47715ce53078abe /fs | |
parent | f95ebdbed46a4d8b9fdb7bff109fdbb6fc9a6dc8 (diff) |
btrfs: document special case error codes for fs errors
We've had some discussions about what to do in certain scenarios for
error codes, specifically EUCLEAN and EROFS. Document these near the
error handling code so its clear what their intentions are.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/super.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 58f890f73650..a4f0bb29b8d6 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -67,6 +67,21 @@ static struct file_system_type btrfs_root_fs_type; static int btrfs_remount(struct super_block *sb, int *flags, char *data); +/* + * Generally the error codes correspond to their respective errors, but there + * are a few special cases. + * + * EUCLEAN: Any sort of corruption that we encounter. The tree-checker for + * instance will return EUCLEAN if any of the blocks are corrupted in + * a way that is problematic. We want to reserve EUCLEAN for these + * sort of corruptions. + * + * EROFS: If we check BTRFS_FS_STATE_ERROR and fail out with a return error, we + * need to use EROFS for this case. We will have no idea of the + * original failure, that will have been reported at the time we tripped + * over the error. Each subsequent error that doesn't have any context + * of the original error should use EROFS when handling BTRFS_FS_STATE_ERROR. + */ const char * __attribute_const__ btrfs_decode_error(int errno) { char *errstr = "unknown"; |