Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-15 Thread Liu Bo
On Fri, Sep 15, 2017 at 08:57:41PM +0200, Goffredo Baroncelli wrote: > 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

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-15 Thread Goffredo Baroncelli
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 f

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-15 Thread Liu Bo
On Fri, Sep 15, 2017 at 12:00:19AM +0200, Goffredo Baroncelli wrote: > Hi all, > > I discovered two bugs when O_DIRECT is used... > > 1) a corrupted file doesn't return -EIO when O_DIRECT is used > > Normally BTRFS prevents to access the contents of a corrupted file; however I > was able read t

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-15 Thread Goffredo Baroncelli
On 09/15/2017 11:50 AM, Marat Khalili wrote: > May I state my user's point of view: > > I know one applications that uses O_DIRECT, and it is subtly broken > on BTRFS. I know no applications that use O_DIRECT and are not > broken. (Really more statistics would help here, probably some exist > that

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-15 Thread Goffredo Baroncelli
On 09/15/2017 07:01 PM, Andrei Borzenkov wrote: > 15.09.2017 08:50, Goffredo Baroncelli пишет: >> On 09/15/2017 05:55 AM, Andrei Borzenkov wrote: >>> 15.09.2017 01:00, Goffredo Baroncelli пишет: 2) The second bug, is a more severe bug. If during a writing of a buffer with O_DIRECT,

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-15 Thread Goffredo Baroncelli
On 09/15/2017 10:26 AM, Hugo Mills wrote: > On Fri, Sep 15, 2017 at 08:04:35AM +0200, Goffredo Baroncelli wrote: >> On 09/15/2017 12:18 AM, Hugo Mills wrote: >>>As far as I know, both of these are basically known issues, with no >>> good solution, other than not using O_DIRECT. Certainly the fi

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-15 Thread Andrei Borzenkov
15.09.2017 08:50, Goffredo Baroncelli пишет: > On 09/15/2017 05:55 AM, Andrei Borzenkov wrote: >> 15.09.2017 01:00, Goffredo Baroncelli пишет: >>> >>> 2) The second bug, is a more severe bug. If during a writing of a buffer >>> with O_DIRECT, the buffer is updated at the same time by a second proc

RE: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-15 Thread Paul Jones
> -Original Message- > From: linux-btrfs-ow...@vger.kernel.org [mailto:linux-btrfs- > ow...@vger.kernel.org] On Behalf Of Marat Khalili > Sent: Friday, 15 September 2017 7:50 PM > To: Hugo Mills ; Goffredo Baroncelli > ; linux-btrfs > Subject: Re: BUG: BTRFS and O

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-15 Thread Marat Khalili
May I state my user's point of view: I know one applications that uses O_DIRECT, and it is subtly broken on BTRFS. I know no applications that use O_DIRECT and are not broken. (Really more statistics would help here, probably some exist that provably work.) According to developers making O_DIR

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-15 Thread Hugo Mills
On Fri, Sep 15, 2017 at 08:04:35AM +0200, Goffredo Baroncelli wrote: > On 09/15/2017 12:18 AM, Hugo Mills wrote: > >As far as I know, both of these are basically known issues, with no > > good solution, other than not using O_DIRECT. Certainly the first > > issue is one I recognise. The second

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-14 Thread Goffredo Baroncelli
On 09/15/2017 12:18 AM, Hugo Mills wrote: >As far as I know, both of these are basically known issues, with no > good solution, other than not using O_DIRECT. Certainly the first > issue is one I recognise. The second isn't one I recognise directly, > but is unsurprising to me. > >There ha

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-14 Thread Goffredo Baroncelli
On 09/15/2017 05:55 AM, Andrei Borzenkov wrote: > 15.09.2017 01:00, Goffredo Baroncelli пишет: >> >> 2) The second bug, is a more severe bug. If during a writing of a buffer >> with O_DIRECT, the buffer is updated at the same time by a second process, >> the checksum may be incorrect. >> > > Is

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-14 Thread Andrei Borzenkov
15.09.2017 01:00, Goffredo Baroncelli пишет: > > 2) The second bug, is a more severe bug. If during a writing of a buffer with > O_DIRECT, the buffer is updated at the same time by a second process, the > checksum may be incorrect. > Is it btrfs specific? If buffer is updated before it was act

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-14 Thread Hugo Mills
As far as I know, both of these are basically known issues, with no good solution, other than not using O_DIRECT. Certainly the first issue is one I recognise. The second isn't one I recognise directly, but is unsurprising to me. There have been discussions -- including developers -- on this