public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 1/2] btrfs-progs: fix check to catch gaps at the start of the file
Date: Thu, 30 Jan 2020 15:47:35 -0500	[thread overview]
Message-ID: <20200130204736.49224-2-josef@toxicpanda.com> (raw)
In-Reply-To: <20200130204736.49224-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 assume the first extent we find is the first valid spot, so
we don't actually add a hole entry if there is no extent at offset 0.
Fix this by setting our extent_start and extent_end to 0 so we can
properly catch the corruption.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 check/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/check/main.c b/check/main.c
index 4115049a..4ce5a63c 100644
--- a/check/main.c
+++ b/check/main.c
@@ -1553,8 +1553,8 @@ static int process_file_extent(struct btrfs_root *root,
 	rec->found_file_extent = 1;
 
 	if (rec->extent_start == (u64)-1) {
-		rec->extent_start = key->offset;
-		rec->extent_end = key->offset;
+		rec->extent_start = 0;
+		rec->extent_end = 0;
 	}
 
 	if (rec->extent_end > key->offset)
-- 
2.24.1


  reply	other threads:[~2020-01-30 20:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 20:47 [PATCH 0/2] Fix btrfs check handling of missing file extents Josef Bacik
2020-01-30 20:47 ` Josef Bacik [this message]
2020-03-05 15:38   ` [PATCH 1/2] btrfs-progs: fix check to catch gaps at the start of the file David Sterba
2020-01-30 20:47 ` [PATCH 2/2] btrfs-progs: fix lowmem check's handling of holes Josef Bacik
2020-03-04 13:53 ` [PATCH 0/2] Fix btrfs check handling of missing file extents 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=20200130204736.49224-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