Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-22 Thread Jan Kara
On Mon 21-09-20 18:59:43, Matthew Wilcox wrote: > On Mon, Sep 21, 2020 at 09:20:25AM -0700, Linus Torvalds wrote: > > On Mon, Sep 21, 2020 at 2:11 AM Jan Kara wrote: > > > > > > Except that on truncate, we have to unmap these > > > anonymous pages in private file mappings as well... > > > > I'm a

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-21 Thread Matthew Wilcox
On Mon, Sep 21, 2020 at 09:20:25AM -0700, Linus Torvalds wrote: > On Mon, Sep 21, 2020 at 2:11 AM Jan Kara wrote: > > > > Except that on truncate, we have to unmap these > > anonymous pages in private file mappings as well... > > I'm actually not 100% sure we strictly would need to care. > > Onc

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-21 Thread Linus Torvalds
On Mon, Sep 21, 2020 at 2:11 AM Jan Kara wrote: > > Except that on truncate, we have to unmap these > anonymous pages in private file mappings as well... I'm actually not 100% sure we strictly would need to care. Once we've faulted in a private file mapping page, that page is "ours". That's kind

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-21 Thread Jan Kara
On Mon 21-09-20 18:26:00, Dave Chinner wrote: > On Thu, Sep 17, 2020 at 12:47:10AM -0700, Hugh Dickins wrote: > > It's because POSIX demanded that when a file > > is truncated, the user will get SIGBUS on trying to access even the > > COWed pages beyond EOF in a MAP_PRIVATE mapping. Page lock on t

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-21 Thread Dave Chinner
On Thu, Sep 17, 2020 at 12:47:10AM -0700, Hugh Dickins wrote: > On Thu, 17 Sep 2020, Dave Chinner wrote: > > On Wed, Sep 16, 2020 at 07:04:46PM -0700, Hugh Dickins wrote: > > > On Thu, 17 Sep 2020, Dave Chinner wrote: > > > > > > > > > > No. filemap_map_pa

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-17 Thread Jan Kara
On Thu 17-09-20 08:37:17, Nikolay Borisov wrote: > On 17.09.20 г. 4:44 ч., Dave Chinner wrote: > > On Wed, Sep 16, 2020 at 05:58:51PM +0200, Jan Kara wrote: > >> On Sat 12-09-20 09:19:11, Amir Goldstein wrote: > >>> On Tue, Jun 23, 2020 at 8:21 AM Dave Chinner wrote: > > > > > > > So > >

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-17 Thread Hugh Dickins
On Thu, 17 Sep 2020, Dave Chinner wrote: > On Wed, Sep 16, 2020 at 07:04:46PM -0700, Hugh Dickins wrote: > > On Thu, 17 Sep 2020, Dave Chinner wrote: > > > > > > > No. filemap_map_pages() checks page->mapping after trylock_page(), > > before setting up the pte;

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-16 Thread Dave Chinner
On Wed, Sep 16, 2020 at 07:04:46PM -0700, Hugh Dickins wrote: > On Thu, 17 Sep 2020, Dave Chinner wrote: > > > > So > > > > P0 p1 > > > > hole punch starts > > takes XFS_MMAPLOCK_EXCL > > truncate_pagecache_range() > > unmap_mapping_range(start, end)

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-16 Thread Nikolay Borisov
On 17.09.20 г. 4:44 ч., Dave Chinner wrote: > On Wed, Sep 16, 2020 at 05:58:51PM +0200, Jan Kara wrote: >> On Sat 12-09-20 09:19:11, Amir Goldstein wrote: >>> On Tue, Jun 23, 2020 at 8:21 AM Dave Chinner wrote: > > So > > P0p1 > > hole punch starts

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-16 Thread Matthew Wilcox
On Thu, Sep 17, 2020 at 11:44:54AM +1000, Dave Chinner wrote: > So > > P0p1 > > hole punch starts > takes XFS_MMAPLOCK_EXCL > truncate_pagecache_range() ... locks page ... > unmap_mapping_range(start, end) > >

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-16 Thread Hugh Dickins
On Thu, 17 Sep 2020, Dave Chinner wrote: > > So > > P0p1 > > hole punch starts > takes XFS_MMAPLOCK_EXCL > truncate_pagecache_range() > unmap_mapping_range(start, end) > > >

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-16 Thread Dave Chinner
On Wed, Sep 16, 2020 at 05:58:51PM +0200, Jan Kara wrote: > On Sat 12-09-20 09:19:11, Amir Goldstein wrote: > > On Tue, Jun 23, 2020 at 8:21 AM Dave Chinner wrote: > > > > > > From: Dave Chinner > > > > > > The page faultround path ->map_pages is implemented in XFS via > > > filemap_map_pages().

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-16 Thread Jan Kara
On Sat 12-09-20 09:19:11, Amir Goldstein wrote: > On Tue, Jun 23, 2020 at 8:21 AM Dave Chinner wrote: > > > > From: Dave Chinner > > > > The page faultround path ->map_pages is implemented in XFS via > > filemap_map_pages(). This function checks that pages found in page > > cache lookups have not

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-14 Thread Andreas Gruenbacher
Could the xfs mmap lock documentation please be cleaned up? For example, the xfs_ilock description says: > * In addition to i_rwsem in the VFS inode, the xfs inode contains 2 > * multi-reader locks: i_mmap_lock and the i_lock. This routine allows > * various combinations of the locks to be obtain

Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-14 Thread Jan Kara
On Sat 12-09-20 09:19:11, Amir Goldstein wrote: > On Tue, Jun 23, 2020 at 8:21 AM Dave Chinner wrote: > > > > From: Dave Chinner > > > > The page faultround path ->map_pages is implemented in XFS via > > filemap_map_pages(). This function checks that pages found in page > > cache lookups have not

More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages())

2020-09-11 Thread Amir Goldstein
On Tue, Jun 23, 2020 at 8:21 AM Dave Chinner wrote: > > From: Dave Chinner > > The page faultround path ->map_pages is implemented in XFS via > filemap_map_pages(). This function checks that pages found in page > cache lookups have not raced with truncate based invalidation by > checking page->ma