Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Goffredo Baroncelli <kreijack@inwind.it>
To: bo.li.liu@oracle.com
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data
Date: Fri, 15 Sep 2017 20:57:41 +0200	[thread overview]
Message-ID: <4639cd06-b201-5082-b967-e104f0f2e0d8@inwind.it> (raw)
In-Reply-To: <20170915170122.GA16835@dhcp-10-211-47-181.usdhcp.oraclecorp.com>

On 09/15/2017 07:01 PM, Liu Bo wrote:
>> Conclusion: even if the file is corrupted and normally BTRFS prevent to access it, using O_DIRECT
>> a) no error is returned to the caller
>> b) instead of the page stored on the disk, it is returned a page filled with 0x01 (according also with the function __readpage_endio_check())
>>
> We've queued a patch[1] to fix it, the behavior was introduced a long
> time ago and we guess it was for testing purpose.
> 
> With the patch, you'll get -EIO from dio read, which is consistent
> with buffered read.

I tried your patch, but it doesn't seem to address this issue. I still got -EIO with a normal file access, and a page filled by 0x01 with O_DIRECT.

If I understand your patch, this address the case where there is no any checksum, which is not this case. The checksum exists and it is valid. It is the data wrong.

BR
G.Baroncelli

> 
> [1],
> https://patchwork.kernel.org/patch/9835505/
> Btrfs: report errors when checksum is not found
> 
> Thanks,
> 
> -liubo
> 


-- 
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5

  reply	other threads:[~2017-09-15 18:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14 22:00 BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data Goffredo Baroncelli
2017-09-14 22:18 ` Hugo Mills
2017-09-15  6:04   ` Goffredo Baroncelli
2017-09-15  8:26     ` Hugo Mills
2017-09-15  9:50       ` Marat Khalili
2017-09-15 10:12         ` Paul Jones
2017-09-15 17:37         ` Goffredo Baroncelli
2017-09-15 17:14       ` Goffredo Baroncelli
2017-09-15  3:55 ` Andrei Borzenkov
2017-09-15  5:50   ` Goffredo Baroncelli
2017-09-15 17:01     ` Andrei Borzenkov
2017-09-15 17:30       ` Goffredo Baroncelli
2017-09-15 17:01 ` Liu Bo
2017-09-15 18:57   ` Goffredo Baroncelli [this message]
2017-09-15 19:14     ` Liu Bo

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=4639cd06-b201-5082-b967-e104f0f2e0d8@inwind.it \
    --to=kreijack@inwind.it \
    --cc=bo.li.liu@oracle.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