block: Add new BLK_STS_SELFTEST status
Subsystems (3)
PATCH 1/2 block: Add new BLK_STS_SELFTEST status
There are a lot of end_io hooks which can do some self test at read/write time.
Normally such selftest should return -EUCLEAN to indicate something unexpected.
However there is no BLK_STS_* bit for that, this makes every selftest error to be interpreted to EIO, which lowers the severity.
This patch will add a new BLK_STS_SELFTEST, to allow the error from endio to be passed to filesystem.
--- block/blk-core.c | 1 + include/linux/blk_types.h | 3 +++ 2 files changed, 4 insertions(+)
block/blk-core.c +1 -0
@@ -135,6 +135,7 @@ static const struct { [BLK_STS_RESOURCE] = { -ENOMEM, "kernel resource" }, [BLK_STS_DEV_RESOURCE] = { -EBUSY, "device resource" }, [BLK_STS_AGAIN] = { -EAGAIN, "nonblocking retry" }, + [BLK_STS_SELFTEST] = { -EUCLEAN, "filesystem selftest" }, /* device mapper special case, should not leak out: */ [BLK_STS_DM_REQUEUE] = { -EREMCHG, "dm internal retry" },
include/linux/blk_types.h +3 -0
@@ -63,6 +63,9 @@ typedef u8 __bitwise blk_status_t;*/ #define BLK_STS_DEV_RESOURCE ((__force blk_status_t)13) +/* Filesystem selftest error */ +#define BLK_STS_SELFTEST ((__force blk_status_t)14) +/** * blk_path_error - returns true if error may be path related * @error: status the request was completed with
Signature · 1 line
2.21.0
PATCH 2/2 btrfs: Add error string for EUCLEAN
Since we're going to support write time tree checker, it's possible that transaction get aborted due to tree-checker, also due to new BLK_STS_SELFTEST bit, we can distinguish real EIO error and EUCLEAN error.
Now add error string for EUCLEAN too.
--- fs/btrfs/super.c | 3 +++ 1 file changed, 3 insertions(+)
fs/btrfs/super.c +3 -0
@@ -86,6 +86,9 @@ const char *btrfs_decode_error(int errno)case -ENOENT : errstr ="No such entry" ;break ; +case -EUCLEAN : + errstr ="Selftest failure" ; +break ; }return errstr;
Signature · 1 line
2.21.0
Re: [PATCH 2/2] btrfs: Add error string for EUCLEAN
Quoted 17 lines · Qu Wenruo
Since we're going to support write time tree checker, it's possible that transaction get aborted due to tree-checker, also due to new
BLK_STS_SELFTESTbit, we can distinguish real EIO error and EUCLEAN error.Now add error string for EUCLEAN too.
Signed-off-by Qu Wenruo <[email protected]>--- fs/btrfs/super.c | 3 +++ 1 file changed, 3 insertions(+)fs/btrfs/super.c +0
-0
fs/btrfs/super.c const char *btrfs_decode_error(int errno) · line 91
Quoted 6 lines
fs/btrfs/super.c +3
-0@@ -86,6 +86,9 @@ const char *btrfs_decode_error(int errno)case -ENOENT : errstr ="No such entry" ;break ; +case -EUCLEAN : + errstr ="Selftest failure" ; +break ;
EUCLEAN usually spits out "Structure needs cleaning" in userspace (and ext4 & xfs have been using it for years to complain about corrupt data), so why diverge here?
Wait... does "tree-checker" mean online metadata checking, and 'selftest failure' is what gets spit out when it finds some metadata it doesn't like?
--D
Quoted 6 lines
fs/btrfs/super.c +0
-0}return errstr;Signature · 1 line
2.21.0
Re: [PATCH 2/2] btrfs: Add error string for EUCLEAN
Quoted 13 lines · Darrick J. Wong
Quoted 12 lines · Qu Wenruo
Since we're going to support write time tree checker, it's possible that transaction get aborted due to tree-checker, also due to new
BLK_STS_SELFTESTbit, we can distinguish real EIO error and EUCLEAN error.Now add error string for EUCLEAN too.
Signed-off-by Qu Wenruo <[email protected]>--- fs/btrfs/super.c | 3 +++ 1 file changed, 3 insertions(+)
Quoted 15 lines
fs/btrfs/super.c const char *btrfs_decode_error(int errno) · line 91
Quoted 11 lines
fs/btrfs/super.c +3
-0@@ -86,6 +86,9 @@ const char *btrfs_decode_error(int errno)case -ENOENT : errstr ="No such entry" ;break ; +case -EUCLEAN : + errstr ="Selftest failure" ; +break ;EUCLEAN usually spits out "Structure needs cleaning" in userspace (and ext4 & xfs have been using it for years to complain about corrupt data), so why diverge here?
Because the original "structure needs cleaning" doesn't really show the meaning we're using.
We really means, something wrong happened, thus I prefer something like selftest failure.
And, the idea of adding -EUCLEAN, is to replace the original "unknown" output, if you're sticking with the original error string, we still need that branch.
Quoted 4 lines
Wait... does "tree-checker" mean online metadata checking, and 'selftest failure' is what gets spit out when it finds some metadata it doesn't like?
Yep.
Thanks,
Qu
Quoted 9 lines
--D
Quoted 6 lines
fs/btrfs/super.c +0
-0}return errstr;Signature · 1 line
2.21.0
Re: [PATCH 2/2] btrfs: Add error string for EUCLEAN
Quoted 32 lines · Qu Wenruo
Quoted 13 lines · Darrick J. Wong
Quoted 12 lines · Qu Wenruo
Since we're going to support write time tree checker, it's possible that transaction get aborted due to tree-checker, also due to new
BLK_STS_SELFTESTbit, we can distinguish real EIO error and EUCLEAN error.Now add error string for EUCLEAN too.
Signed-off-by Qu Wenruo <[email protected]>--- fs/btrfs/super.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 15 lines
fs/btrfs/super.c const char *btrfs_decode_error(int errno) · line 91
Quoted 11 lines
fs/btrfs/super.c +3
-0@@ -86,6 +86,9 @@ const char *btrfs_decode_error(int errno)case -ENOENT : errstr ="No such entry" ;break ; +case -EUCLEAN : + errstr ="Selftest failure" ; +break ;EUCLEAN usually spits out "Structure needs cleaning" in userspace (and ext4 & xfs have been using it for years to complain about corrupt data), so why diverge here?
Quoted 2 lines
Because the original "structure needs cleaning" doesn't really show the meaning we're using.
On the contrary, structure needs cleaning means the filesystem has detected a consistency error. How that detection has happened shouldn't burden the user, the important fact is it has. Selftest is somewhat cryptic, I'd suggest at least "verification error" or just go with canonical "Structure needs cleaning".
Quoted 28 lines
We really means, something wrong happened, thus I prefer something like selftest failure.
And, the idea of adding
-EUCLEAN, is to replace the original "unknown" output, if you're sticking with the original error string, we still need that branch.Quoted 4 lines
Wait... does "tree-checker" mean online metadata checking, and 'selftest failure' is what gets spit out when it finds some metadata it doesn't like?
Yep.
Thanks,
QuQuoted 9 lines
--D
Quoted 6 lines
fs/btrfs/super.c +0
-0}return errstr;Signature · 1 line
2.21.0
Re: [PATCH 2/2] btrfs: Add error string for EUCLEAN
Quoted 35 lines · Nikolay Borisov
Quoted 32 lines · Qu Wenruo
Quoted 28 lines · Darrick J. Wong
Quoted 17 lines · Qu Wenruo
Since we're going to support write time tree checker, it's possible that transaction get aborted due to tree-checker, also due to new
BLK_STS_SELFTESTbit, we can distinguish real EIO error and EUCLEAN error.Now add error string for EUCLEAN too.
Signed-off-by Qu Wenruo <[email protected]>--- fs/btrfs/super.c | 3 +++ 1 file changed, 3 insertions(+)fs/btrfs/super.c +0
-0fs/btrfs/super.c const char *btrfs_decode_error(int errno) · line 91
Quoted 6 lines
fs/btrfs/super.c +3
-0@@ -86,6 +86,9 @@ const char *btrfs_decode_error(int errno)case -ENOENT : errstr ="No such entry" ;break ; +case -EUCLEAN : + errstr ="Selftest failure" ; +break ;EUCLEAN usually spits out "Structure needs cleaning" in userspace (and ext4 & xfs have been using it for years to complain about corrupt data), so why diverge here?
Quoted 8 lines
Quoted 2 lines
Because the original "structure needs cleaning" doesn't really show the meaning we're using.
On the contrary, structure needs cleaning means the filesystem has detected a consistency error. How that detection has happened shouldn't burden the user, the important fact is it has. Selftest is somewhat cryptic, I'd suggest at least "verification error" or just go with canonical "Structure needs cleaning".
OK, I'll go that way.
Thanks for the hint,
Qu
Quoted 29 lines
Quoted 29 lines
We really means, something wrong happened, thus I prefer something like selftest failure.
And, the idea of adding
-EUCLEAN, is to replace the original "unknown" output, if you're sticking with the original error string, we still need that branch.Quoted 4 lines
Wait... does "tree-checker" mean online metadata checking, and 'selftest failure' is what gets spit out when it finds some metadata it doesn't like?
Yep.
Thanks,
QuQuoted 9 lines
--D
Quoted 6 lines
fs/btrfs/super.c +0
-1}return errstr; --2.21.0
Quoted 23 lines · Qu Wenruo
There are a lot of
end_iohooks which can do some self test at read/write time.Normally such selftest should return
-EUCLEANto indicate something unexpected.However there is no BLK_STS_* bit for that, this makes every selftest error to be interpreted to EIO, which lowers the severity.
This patch will add a new
BLK_STS_SELFTEST, to allow the error from endio to be passed to filesystem.Signed-off-by Qu Wenruo <[email protected]>--- block/blk-core.c | 1 + include/linux/blk_types.h | 3 +++ 2 files changed, 4 insertions(+)block/blk-core.c +0
-0
block/blk-core.c static const struct { · line 138
Quoted 4 lines
block/blk-core.c +1
-0@@ -135,6 +135,7 @@ static const struct { [BLK_STS_RESOURCE] = { -ENOMEM, "kernel resource" }, [BLK_STS_DEV_RESOURCE] = { -EBUSY, "device resource" }, [BLK_STS_AGAIN] = { -EAGAIN, "nonblocking retry" }, + [BLK_STS_SELFTEST] = { -EUCLEAN, "filesystem selftest" },
SELFTEST is ambiguous, I personally relate it to the selftests that some subsystems have. This should be changed to STS_CLEANUP or STS_CORRUPT or some such.
Quoted 18 lines
block/blk-core.c +0
-0/* device mapper special case, should not leak out: */ [BLK_STS_DM_REQUEUE] = { -EREMCHG, "dm internal retry" },include/linux/blk_types.h +3
-0@@ -63,6 +63,9 @@ typedef u8 __bitwise blk_status_t;*/ #define BLK_STS_DEV_RESOURCE ((__force blk_status_t)13) +/* Filesystem selftest error */ +#define BLK_STS_SELFTEST ((__force blk_status_t)14) +/** * blk_path_error - returns true if error may be path related * @error: status the request was completed with
Quoted 21 lines · Nikolay Borisov
Quoted 18 lines · Qu Wenruo
There are a lot of
end_iohooks which can do some self test at read/write time.Normally such selftest should return
-EUCLEANto indicate something unexpected.However there is no BLK_STS_* bit for that, this makes every selftest error to be interpreted to EIO, which lowers the severity.
This patch will add a new
BLK_STS_SELFTEST, to allow the error from endio to be passed to filesystem.Signed-off-by Qu Wenruo <[email protected]>--- block/blk-core.c | 1 + include/linux/blk_types.h | 3 +++ 2 files changed, 4 insertions(+)
Quoted 13 lines
block/blk-core.c static const struct { · line 138
Quoted 9 lines
block/blk-core.c +1
-0@@ -135,6 +135,7 @@ static const struct { [BLK_STS_RESOURCE] = { -ENOMEM, "kernel resource" }, [BLK_STS_DEV_RESOURCE] = { -EBUSY, "device resource" }, [BLK_STS_AGAIN] = { -EAGAIN, "nonblocking retry" }, + [BLK_STS_SELFTEST] = { -EUCLEAN, "filesystem selftest" },SELFTEST is ambiguous, I personally relate it to the selftests that some subsystems have. This should be changed to
STS_CLEANUPorSTS_CORRUPTor some such.
Considering my poor naming schemes, what about sticking to EUCLEAN across all of these?BLK_STS_UCLEAN -ECULEAN "Structure needs clean up"
Thanks,
Qu
Quoted 19 lines
Quoted 19 lines
block/blk-core.c +0
-0/* device mapper special case, should not leak out: */ [BLK_STS_DM_REQUEUE] = { -EREMCHG, "dm internal retry" },include/linux/blk_types.h +3
-0@@ -63,6 +63,9 @@ typedef u8 __bitwise blk_status_t;*/ #define BLK_STS_DEV_RESOURCE ((__force blk_status_t)13) +/* Filesystem selftest error */ +#define BLK_STS_SELFTEST ((__force blk_status_t)14) +/** * blk_path_error - returns true if error may be path related * @error: status the request was completed with
Quoted 38 lines · Qu Wenruo
Quoted 21 lines · Nikolay Borisov
Quoted 18 lines · Qu Wenruo
There are a lot of
end_iohooks which can do some self test at read/write time.Normally such selftest should return
-EUCLEANto indicate something unexpected.However there is no BLK_STS_* bit for that, this makes every selftest error to be interpreted to EIO, which lowers the severity.
This patch will add a new
BLK_STS_SELFTEST, to allow the error from endio to be passed to filesystem.Signed-off-by Qu Wenruo <[email protected]>--- block/blk-core.c | 1 + include/linux/blk_types.h | 3 +++ 2 files changed, 4 insertions(+)Quoted 13 lines
block/blk-core.c static const struct { · line 138
Quoted 9 lines
block/blk-core.c +1
-0@@ -135,6 +135,7 @@ static const struct { [BLK_STS_RESOURCE] = { -ENOMEM, "kernel resource" }, [BLK_STS_DEV_RESOURCE] = { -EBUSY, "device resource" }, [BLK_STS_AGAIN] = { -EAGAIN, "nonblocking retry" }, + [BLK_STS_SELFTEST] = { -EUCLEAN, "filesystem selftest" },SELFTEST is ambiguous, I personally relate it to the selftests that some subsystems have. This should be changed to
STS_CLEANUPorSTS_CORRUPTor some such.
Quoted 3 lines
Considering my poor naming schemes, what about sticking to EUCLEAN across all of these?
BLK_STS_UCLEAN-ECULEAN"Structure needs clean up"
Sounds good!
Quoted 24 lines
Thanks,
QuQuoted 19 lines
Quoted 19 lines
block/blk-core.c +0
-0/* device mapper special case, should not leak out: */ [BLK_STS_DM_REQUEUE] = { -EREMCHG, "dm internal retry" },include/linux/blk_types.h +3
-0@@ -63,6 +63,9 @@ typedef u8 __bitwise blk_status_t;*/ #define BLK_STS_DEV_RESOURCE ((__force blk_status_t)13) +/* Filesystem selftest error */ +#define BLK_STS_SELFTEST ((__force blk_status_t)14) +/** * blk_path_error - returns true if error may be path related * @error: status the request was completed with