From: Josef Bacik <josef@toxicpanda.com>
To: kernel-team@fb.com, linux-btrfs@vger.kernel.org
Subject: [PATCH 1/3] btrfs-progs: fix check to catch gaps at the start of the file
Date: Tue, 4 Feb 2020 09:32:40 -0500 [thread overview]
Message-ID: <20200204143243.696500-2-josef@toxicpanda.com> (raw)
In-Reply-To: <20200204143243.696500-1-josef@toxicpanda.com>
When writing my test for the i_size patches, I noticed that I was not
actually failing without my patches as I should have been. This is
because we only check if the inode record extent end is < isize, we
don't check if the inode record extent start is > 0. Add this check to
make sure we're catching holes that start at the beginning of the file.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
check/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/check/main.c b/check/main.c
index 4115049a..22f4e24c 100644
--- a/check/main.c
+++ b/check/main.c
@@ -827,8 +827,9 @@ static void maybe_free_inode_rec(struct cache_tree *inode_cache,
/* Orphan inodes don't have correct nbytes */
if (rec->nlink > 0 && rec->found_size != rec->nbytes)
rec->errors |= I_ERR_FILE_NBYTES_WRONG;
- if (rec->nlink > 0 && !no_holes &&
+ if (rec->nlink > 0 && !no_holes && rec->isize &&
(rec->extent_end < rec->isize ||
+ rec->extent_start != 0 ||
first_extent_gap(&rec->holes) < rec->isize))
rec->errors |= I_ERR_FILE_EXTENT_DISCOUNT;
}
--
2.24.1
next prev parent reply other threads:[~2020-02-04 14:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-04 14:32 [PATCH 0/3][v2] Fix btrfs check handling of missing file extents Josef Bacik
2020-02-04 14:32 ` Josef Bacik [this message]
2020-02-04 14:32 ` [PATCH 2/3] btrfs-progs: fix lowmem check's handling of holes Josef Bacik
2020-02-04 14:32 ` [PATCH 3/3] btrfs-progs: fix hole error output in fsck Josef Bacik
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=20200204143243.696500-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