diff mbox series

[1/2] block: Add new BLK_STS_SELFTEST status

Message ID 20190406031426.22436-1-wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series [1/2] block: Add new BLK_STS_SELFTEST status | expand

Commit Message

Qu Wenruo April 6, 2019, 3:14 a.m. UTC
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.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 block/blk-core.c          | 1 +
 include/linux/blk_types.h | 3 +++
 2 files changed, 4 insertions(+)

Comments

Nikolay Borisov April 6, 2019, 8:41 a.m. UTC | #1
On 6.04.19 г. 6:14 ч., Qu Wenruo wrote:
> 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.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
>  block/blk-core.c          | 1 +
>  include/linux/blk_types.h | 3 +++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 4673ebe42255..66967642a5ef 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -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.

>  
>  	/* device mapper special case, should not leak out: */
>  	[BLK_STS_DM_REQUEUE]	= { -EREMCHG, "dm internal retry" },
> diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
> index 791fee35df88..5bba24c3753c 100644
> --- a/include/linux/blk_types.h
> +++ b/include/linux/blk_types.h
> @@ -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
>
Qu Wenruo April 6, 2019, 9:18 a.m. UTC | #2
On 2019/4/6 下午4:41, Nikolay Borisov wrote:
>
>
> On 6.04.19 г. 6:14 ч., Qu Wenruo wrote:
>> 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.
>>
>> Signed-off-by: Qu Wenruo <wqu@suse.com>
>> ---
>>  block/blk-core.c          | 1 +
>>  include/linux/blk_types.h | 3 +++
>>  2 files changed, 4 insertions(+)
>>
>> diff --git a/block/blk-core.c b/block/blk-core.c
>> index 4673ebe42255..66967642a5ef 100644
>> --- a/block/blk-core.c
>> +++ b/block/blk-core.c
>> @@ -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.

Considering my poor naming schemes, what about sticking to EUCLEAN
across all of these?
BLK_STS_UCLEAN	-ECULEAN "Structure needs clean up"

Thanks,
Qu

>
>>
>>  	/* device mapper special case, should not leak out: */
>>  	[BLK_STS_DM_REQUEUE]	= { -EREMCHG, "dm internal retry" },
>> diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
>> index 791fee35df88..5bba24c3753c 100644
>> --- a/include/linux/blk_types.h
>> +++ b/include/linux/blk_types.h
>> @@ -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
>>
Nikolay Borisov April 6, 2019, 9:31 a.m. UTC | #3
On 6.04.19 г. 12:18 ч., Qu Wenruo wrote:
> 
> 
> On 2019/4/6 下午4:41, Nikolay Borisov wrote:
>>
>>
>> On 6.04.19 г. 6:14 ч., Qu Wenruo wrote:
>>> 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.
>>>
>>> Signed-off-by: Qu Wenruo <wqu@suse.com>
>>> ---
>>>  block/blk-core.c          | 1 +
>>>  include/linux/blk_types.h | 3 +++
>>>  2 files changed, 4 insertions(+)
>>>
>>> diff --git a/block/blk-core.c b/block/blk-core.c
>>> index 4673ebe42255..66967642a5ef 100644
>>> --- a/block/blk-core.c
>>> +++ b/block/blk-core.c
>>> @@ -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.
> 
> Considering my poor naming schemes, what about sticking to EUCLEAN
> across all of these?
> BLK_STS_UCLEAN	-ECULEAN "Structure needs clean up"

Sounds good!
> 
> Thanks,
> Qu
> 
>>
>>>
>>>  	/* device mapper special case, should not leak out: */
>>>  	[BLK_STS_DM_REQUEUE]	= { -EREMCHG, "dm internal retry" },
>>> diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
>>> index 791fee35df88..5bba24c3753c 100644
>>> --- a/include/linux/blk_types.h
>>> +++ b/include/linux/blk_types.h
>>> @@ -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
>>>
>
diff mbox series

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index 4673ebe42255..66967642a5ef 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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" },
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 791fee35df88..5bba24c3753c 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -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