From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, kernel test robot <oliver.sang@intel.com>
Subject: Re: [PATCH] btrfs: fix wrong offset to zero out range beyond isize
Date: Mon, 8 Mar 2021 16:59:11 +0100 [thread overview]
Message-ID: <20210308155911.GC7604@twin.jikos.cz> (raw)
In-Reply-To: <20210308092017.81059-1-wqu@suse.com>
On Mon, Mar 08, 2021 at 05:20:17PM +0800, Qu Wenruo wrote:
> [BUG]
> Btrfs fails at generic/091 test case, with the following output:
>
> fsx -N 10000 -o 128000 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -W
> mapped writes DISABLED
> Seed set to 1
> main: filesystem does not support fallocate mode FALLOC_FL_COLLAPSE_RANGE, disabling!
> main: filesystem does not support fallocate mode FALLOC_FL_INSERT_RANGE, disabling!
> skipping zero size read
> truncating to largest ever: 0xe400
> copying to largest ever: 0x1f400
> cloning to largest ever: 0x70000
> cloning to largest ever: 0x77000
> fallocating to largest ever: 0x7a120
> Mapped Read: non-zero data past EOF (0x3a7ff) page offset 0x800 is 0xf2e1 <<<
> ...
>
> [CAUSE]
> In commit c28ea613fafa ("btrfs: subpage: fix the false data csum mismatch error")
> end_bio_extent_readpage() changes to only zero the range inside the bvec
> for incoming subpage support.
>
> But that commit is using incorrect offset to calculate the start.
>
> For subpage, we can have a case that the whole bvec is beyond isize,
> thus we need to calculate the correct offset.
>
> But the offending commit is using @end (bvec end), other than @start
> (bvec start) to calculate the start offset.
>
> This means, we only zero the last byte of the bvec, not from the isize.
> This stupid bug makes the range beyond isize is not properly zeroed, and
> failed above test.
>
> [FIX]
> Use correct @start to calculate the range start.
>
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Added to misc-next, thanks.
prev parent reply other threads:[~2021-03-08 16:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 9:20 [PATCH] btrfs: fix wrong offset to zero out range beyond isize Qu Wenruo
2021-03-08 15:59 ` David Sterba [this message]
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=20210308155911.GC7604@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=oliver.sang@intel.com \
--cc=wqu@suse.com \
/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