Skip to content

Commit 5913139

Browse files
josefbacikkdave
authored andcommitted
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 <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent f95ebdb commit 5913139

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

fs/btrfs/super.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,21 @@ static struct file_system_type btrfs_root_fs_type;
6767

6868
static int btrfs_remount(struct super_block *sb, int *flags, char *data);
6969

70+
/*
71+
* Generally the error codes correspond to their respective errors, but there
72+
* are a few special cases.
73+
*
74+
* EUCLEAN: Any sort of corruption that we encounter. The tree-checker for
75+
* instance will return EUCLEAN if any of the blocks are corrupted in
76+
* a way that is problematic. We want to reserve EUCLEAN for these
77+
* sort of corruptions.
78+
*
79+
* EROFS: If we check BTRFS_FS_STATE_ERROR and fail out with a return error, we
80+
* need to use EROFS for this case. We will have no idea of the
81+
* original failure, that will have been reported at the time we tripped
82+
* over the error. Each subsequent error that doesn't have any context
83+
* of the original error should use EROFS when handling BTRFS_FS_STATE_ERROR.
84+
*/
7085
const char * __attribute_const__ btrfs_decode_error(int errno)
7186
{
7287
char *errstr = "unknown";

0 commit comments

Comments
 (0)