From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 2/2] btrfs: document special case error codes for fs errors
Date: Tue, 21 Jul 2020 11:24:28 -0400 [thread overview]
Message-ID: <20200721152428.9934-2-josef@toxicpanda.com> (raw)
In-Reply-To: <20200721152428.9934-1-josef@toxicpanda.com>
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 <josef@toxicpanda.com>
---
fs/btrfs/super.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 58f890f73650..688d1ab95b2b 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -67,6 +67,21 @@ static struct file_system_type btrfs_root_fs_type;
static int btrfs_remount(struct super_block *sb, int *flags, char *data);
+/*
+ * Generally the error codes correspond to their respective errors, but there's
+ * a few special cases.
+ *
+ * -EUCLEAN: Any sort of corruption that we encounter. The tree-checker for
+ * instance will return -EUCLEAN if any of the blocks are corrupted in a way
+ * that is problematic. We want to reserve -EUCLEAN for these sort of
+ * corruptions.
+ *
+ * -EROFS: If we check BTRFS_FS_STATE_ERROR and fail out with a return error, we
+ * need to use -EROFS for this case. We will have no idea of the original
+ * failure, that will have been reported at the time we tripped over the error.
+ * Each subsequent error that doesn't have any context of the original error
+ * should use -EROFS when handling BTRFS_FS_STATE_ERROR.
+ */
const char * __attribute_const__ btrfs_decode_error(int errno)
{
char *errstr = "unknown";
--
2.24.1
next prev parent reply other threads:[~2020-07-21 15:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-21 15:24 [PATCH 1/2] btrfs: don't WARN_ON() if we abort a transaction with -EROFS Josef Bacik
2020-07-21 15:24 ` Josef Bacik [this message]
2020-07-21 15:50 ` David Sterba
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=20200721152428.9934-2-josef@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox