Re: [PATCH 2/2] block: Add new BLK_STS_FSCORRUPTED status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 10.04.19 г. 11:35 ч., Qu Wenruo wrote:
> There are quite a lot of filesystems doing their verification work done
> at endio hook or hook before submitting bio.
> 
> Normally such verification returns -EUCLEAN/-EFSCORRUPTED to indicate
> something unexpected, and some of such verification either use> bio->bi_status or users bio->bi_endio to return their value.

Usually filesystems return -EUCLEAN/-EFSCORRUPTED to indicate failed
verification. Currently there is no strict way how this information is
communicated - either via bio->bi_status or through the bio's endio
return value.

> 
> In such case, the missing of corresponding BLK_STS_ bit can lower
> the severity just like:
> 
>   In endio function:
> 	return errno_to_blk_status(-EFSCORRUPTED);
>  	^^^ -EFSCORRUPTED gets interpreted to BLK_STS_IOERR
> 
>   In the filesystem code:
> 	ret = blk_status_to_errno(bi->bi_status);
> 	^^^ BLK_STS_IOERR gets interpreted to -EIO;
> 
> This lowers the severity, making the filesystem layer to believe it's
> just an ordinary error.
> 
> This patch will add a new BLK_STS_FSCORRUPTED, to allow -EFSCORRUPTED to
> be converted to BLK_STS_FSCORRUPTED, and then converted back to
> -EFSCORRUPTED without losing info.

This patch will add a new BLK_STS_FSCORRUPTED block status code,
allowing filesystem corruptions to be properly communicated to upper
layers.

> 
> Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
> ---
>  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 a55389ba8779..ba7acfc3d8e0 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_FSCORRUPTED]	= { -EFSCORRUPTED, "filesystem is corrupted" },
>  
>  	/* 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..8f70bbec6c83 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)
>  
> +/* Normally filesystem layer generated error */
> +#define BLK_STS_FSCORRUPTED	((__force blk_status_t)14)
> +
>  /**
>   * blk_path_error - returns true if error may be path related
>   * @error: status the request was completed with
> 



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux