Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-22 Thread Nikolay Borisov
On 23.02.2018 01:39, David Sterba wrote: > On Thu, Feb 22, 2018 at 12:24:40PM -0700, Liu Bo wrote: > Not even that far, isize is truncated before calling inode_dio_wait() > and a memory barrier is set to ensure the correct order, so dio read > would simply return if it's reading past

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-22 Thread David Sterba
On Thu, Feb 22, 2018 at 12:24:40PM -0700, Liu Bo wrote: > > > > Not even that far, isize is truncated before calling inode_dio_wait() > > > > and a memory barrier is set to ensure the correct order, so dio read > > > > would simply return if it's reading past isize. > > > > > > Please, describe

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-22 Thread Liu Bo
On Thu, Feb 22, 2018 at 12:09:45PM -0700, Liu Bo wrote: > On Thu, Feb 22, 2018 at 08:49:30AM +0200, Nikolay Borisov wrote: > > > > > > On 22.02.2018 00:38, Liu Bo wrote: > > > On Wed, Feb 21, 2018 at 07:05:13PM +, Filipe Manana wrote: > > >> On Wed, Feb 21, 2018 at 6:28 PM, Liu Bo

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-22 Thread Liu Bo
On Thu, Feb 22, 2018 at 08:49:30AM +0200, Nikolay Borisov wrote: > > > On 22.02.2018 00:38, Liu Bo wrote: > > On Wed, Feb 21, 2018 at 07:05:13PM +, Filipe Manana wrote: > >> On Wed, Feb 21, 2018 at 6:28 PM, Liu Bo wrote: > >>> On Wed, Feb 21, 2018 at 02:42:08PM +,

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-22 Thread Filipe Manana
On Wed, Feb 21, 2018 at 10:38 PM, Liu Bo wrote: > On Wed, Feb 21, 2018 at 07:05:13PM +, Filipe Manana wrote: >> On Wed, Feb 21, 2018 at 6:28 PM, Liu Bo wrote: >> > On Wed, Feb 21, 2018 at 02:42:08PM +, Filipe Manana wrote: >> >> On Wed, Feb 21,

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Nikolay Borisov
On 22.02.2018 00:38, Liu Bo wrote: > On Wed, Feb 21, 2018 at 07:05:13PM +, Filipe Manana wrote: >> On Wed, Feb 21, 2018 at 6:28 PM, Liu Bo wrote: >>> On Wed, Feb 21, 2018 at 02:42:08PM +, Filipe Manana wrote: On Wed, Feb 21, 2018 at 2:15 PM, Nikolay Borisov

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Liu Bo
On Wed, Feb 21, 2018 at 07:05:13PM +, Filipe Manana wrote: > On Wed, Feb 21, 2018 at 6:28 PM, Liu Bo wrote: > > On Wed, Feb 21, 2018 at 02:42:08PM +, Filipe Manana wrote: > >> On Wed, Feb 21, 2018 at 2:15 PM, Nikolay Borisov wrote: > >> > > >> > >

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Liu Bo
On Wed, Feb 21, 2018 at 04:15:38PM +0200, Nikolay Borisov wrote: > > > On 21.02.2018 15:51, Filipe Manana wrote: > > On Wed, Feb 21, 2018 at 11:41 AM, Nikolay Borisov wrote: > >> Currently the DIO read cases uses a botched idea from ext4 to ensure > >> that DIO reads don't

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Nikolay Borisov
On 21.02.2018 20:28, Liu Bo wrote: > On Wed, Feb 21, 2018 at 02:42:08PM +, Filipe Manana wrote: >> On Wed, Feb 21, 2018 at 2:15 PM, Nikolay Borisov wrote: >>> >>> >>> On 21.02.2018 15:51, Filipe Manana wrote: On Wed, Feb 21, 2018 at 11:41 AM, Nikolay Borisov

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Filipe Manana
On Wed, Feb 21, 2018 at 6:28 PM, Liu Bo wrote: > On Wed, Feb 21, 2018 at 02:42:08PM +, Filipe Manana wrote: >> On Wed, Feb 21, 2018 at 2:15 PM, Nikolay Borisov wrote: >> > >> > >> > On 21.02.2018 15:51, Filipe Manana wrote: >> >> On Wed, Feb 21, 2018

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Liu Bo
On Wed, Feb 21, 2018 at 02:42:08PM +, Filipe Manana wrote: > On Wed, Feb 21, 2018 at 2:15 PM, Nikolay Borisov wrote: > > > > > > On 21.02.2018 15:51, Filipe Manana wrote: > >> On Wed, Feb 21, 2018 at 11:41 AM, Nikolay Borisov > >> wrote: > >>> Currently

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Filipe Manana
On Wed, Feb 21, 2018 at 2:15 PM, Nikolay Borisov wrote: > > > On 21.02.2018 15:51, Filipe Manana wrote: >> On Wed, Feb 21, 2018 at 11:41 AM, Nikolay Borisov wrote: >>> Currently the DIO read cases uses a botched idea from ext4 to ensure >>> that DIO reads

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Nikolay Borisov
On 21.02.2018 15:51, Filipe Manana wrote: > On Wed, Feb 21, 2018 at 11:41 AM, Nikolay Borisov wrote: >> Currently the DIO read cases uses a botched idea from ext4 to ensure >> that DIO reads don't race with truncate. The idea is that if we have a >> pending truncate we set

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Filipe Manana
On Wed, Feb 21, 2018 at 11:41 AM, Nikolay Borisov wrote: > Currently the DIO read cases uses a botched idea from ext4 to ensure > that DIO reads don't race with truncate. The idea is that if we have a > pending truncate we set BTRFS_INODE_READDIO_NEED_LOCK which in turn >

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Filipe Manana
On Wed, Feb 21, 2018 at 11:41 AM, Nikolay Borisov wrote: > Currently the DIO read cases uses a botched idea from ext4 to ensure > that DIO reads don't race with truncate. The idea is that if we have a > pending truncate we set BTRFS_INODE_READDIO_NEED_LOCK which in turn >

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Nikolay Borisov
On 21.02.2018 15:06, Filipe Manana wrote: > On Wed, Feb 21, 2018 at 11:41 AM, Nikolay Borisov wrote: >> Currently the DIO read cases uses a botched idea from ext4 to ensure >> that DIO reads don't race with truncate. The idea is that if we have a >> pending truncate we set

Re: [PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Filipe Manana
On Wed, Feb 21, 2018 at 1:10 PM, Nikolay Borisov wrote: > > > On 21.02.2018 15:06, Filipe Manana wrote: >> On Wed, Feb 21, 2018 at 11:41 AM, Nikolay Borisov wrote: >>> Currently the DIO read cases uses a botched idea from ext4 to ensure >>> that DIO reads

[PATCH] btrfs: Fix locking during DIO read

2018-02-21 Thread Nikolay Borisov
Currently the DIO read cases uses a botched idea from ext4 to ensure that DIO reads don't race with truncate. The idea is that if we have a pending truncate we set BTRFS_INODE_READDIO_NEED_LOCK which in turn forces the dio read case to fallback to inode_locking to prevent read/truncate races.