All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org, linux-block@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH 2/2] block: Add new BLK_STS_FSCORRUPTED status
Date: Wed, 10 Apr 2019 16:35:08 +0800	[thread overview]
Message-ID: <20190410083508.21091-2-wqu@suse.com> (raw)
In-Reply-To: <20190410083508.21091-1-wqu@suse.com>

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.

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.

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 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
-- 
2.21.0


  reply	other threads:[~2019-04-10  8:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10  8:35 [PATCH RFC 1/2] errno.h: Export EFSCORRUPTED error number Qu Wenruo
2019-04-10  8:35 ` Qu Wenruo [this message]
2019-04-10  8:55   ` [PATCH 2/2] block: Add new BLK_STS_FSCORRUPTED status Nikolay Borisov
2019-04-10 13:04   ` kbuild test robot
2019-04-10 15:11 ` [PATCH RFC 1/2] errno.h: Export EFSCORRUPTED error number Darrick J. Wong
2019-04-10 15:28   ` Nikolay Borisov
2019-04-11  0:28   ` Qu Wenruo
2019-04-11  1:06     ` Darrick J. Wong
2019-04-11  1:43       ` Qu Wenruo
2019-04-11  1:47         ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190410083508.21091-2-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.