Re: [PATCH 04/14] iomap: Call inode_dio_end() before generic_write_sync()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 28, 2020 at 05:04:19PM +0200, David Sterba wrote:
> On Fri, Sep 25, 2020 at 06:51:08PM -0700, Darrick J. Wong wrote:
> > On Thu, Sep 24, 2020 at 11:39:11AM -0500, Goldwyn Rodrigues wrote:
> > > From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>
> > > 
> > > iomap complete routine can deadlock with btrfs_fallocate because of the
> > > call to generic_write_sync().
> > > 
> > > P0                      P1
> > > inode_lock()            fallocate(FALLOC_FL_ZERO_RANGE)
> > > __iomap_dio_rw()        inode_lock()
> > >                         <block>
> > > <submits IO>
> > > <completes IO>
> > > inode_unlock()
> > >                         <gets inode_lock()>
> > >                         inode_dio_wait()
> > > iomap_dio_complete()
> > >   generic_write_sync()
> > >     btrfs_file_fsync()
> > >       inode_lock()
> > >       <deadlock>
> > > 
> > > inode_dio_end() is used to notify the end of DIO data in order
> > > to synchronize with truncate. Call inode_dio_end() before calling
> > > generic_write_sync(), so filesystems can lock i_rwsem during a sync.
> > > 
> > > This matches the way it is done in fs/direct-io.c:dio_complete().
> > > 
> > > Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>
> > > Reviewed-by: Christoph Hellwig <hch@xxxxxx>
> > > Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
> > 
> > Looks ok (at least with the fses that use either iomap or ye olde
> > directio) to me...
> > 
> > Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > 
> > So, uh, do you want me to pull these two iomap patches in for 5.10?
> 
> That would be great, thanks. Once they land in 5.10-rc we'll be able to
> base the rest on some master snapshot and target 5.11 for release.

Ok, done. :)

--D



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux