From: Jan Kara <jack@suse.cz> To: "Darrick J. Wong" <djwong@kernel.org> Cc: Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org, Christoph Hellwig <hch@infradead.org>, Dave Chinner <david@fromorbit.com>, ceph-devel@vger.kernel.org, Chao Yu <yuchao0@huawei.com>, Damien Le Moal <damien.lemoal@wdc.com>, "Darrick J. Wong" <darrick.wong@oracle.com>, Jaegeuk Kim <jaegeuk@kernel.org>, Jeff Layton <jlayton@kernel.org>, Johannes Thumshirn <jth@kernel.org>, linux-cifs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mm@kvack.org, linux-xfs@vger.kernel.org, Miklos Szeredi <miklos@szeredi.hu>, Steve French <sfrench@samba.org>, Ted Tso <tytso@mit.edu>, Matthew Wilcox <willy@infradead.org>, Christoph Hellwig <hch@lst.de> Subject: Re: [PATCH 07/13] xfs: Convert to use invalidate_lock Date: Thu, 27 May 2021 14:01:47 +0200 [thread overview] Message-ID: <20210527120147.GD24486@quack2.suse.cz> (raw) In-Reply-To: <20210526153251.GZ202121@locust> On Wed 26-05-21 08:32:51, Darrick J. Wong wrote: > On Wed, May 26, 2021 at 12:18:40PM +0200, Jan Kara wrote: > > On Tue 25-05-21 14:37:29, Darrick J. Wong wrote: > > > On Tue, May 25, 2021 at 03:50:44PM +0200, Jan Kara wrote: > > > > Use invalidate_lock instead of XFS internal i_mmap_lock. The intended > > > > purpose of invalidate_lock is exactly the same. Note that the locking in > > > > __xfs_filemap_fault() slightly changes as filemap_fault() already takes > > > > invalidate_lock. > > > > > > > > Reviewed-by: Christoph Hellwig <hch@lst.de> > > > > CC: <linux-xfs@vger.kernel.org> > > > > CC: "Darrick J. Wong" <darrick.wong@oracle.com> > > > > > > It's djwong@kernel.org now. > > > > OK, updated. > > > > > > @@ -355,8 +358,11 @@ xfs_isilocked( > > > > > > > > if (lock_flags & (XFS_MMAPLOCK_EXCL|XFS_MMAPLOCK_SHARED)) { > > > > if (!(lock_flags & XFS_MMAPLOCK_SHARED)) > > > > - return !!ip->i_mmaplock.mr_writer; > > > > - return rwsem_is_locked(&ip->i_mmaplock.mr_lock); > > > > + return !debug_locks || > > > > + lockdep_is_held_type( > > > > + &VFS_I(ip)->i_mapping->invalidate_lock, > > > > + 0); > > > > + return rwsem_is_locked(&VFS_I(ip)->i_mapping->invalidate_lock); > > > > > > This doesn't look right... > > > > > > If lockdep is disabled, we always return true for > > > xfs_isilocked(ip, XFS_MMAPLOCK_EXCL) even if nobody holds the lock? > > > > > > Granted, you probably just copy-pasted from the IOLOCK_SHARED clause > > > beneath it. Er... oh right, preichl was messing with all that... > > > > > > https://lore.kernel.org/linux-xfs/20201016021005.548850-2-preichl@redhat.com/ > > > > Indeed copy-paste programming ;) It certainly makes the assertions happy > > but useless. Should I pull the patch you reference into the series? It > > seems to have been uncontroversial and reviewed. Or will you pull the > > series to xfs tree so I can just rebase on top? > > The full conversion series introduced assertion failures because lockdep > can't handle some of the ILOCK usage patterns, specifically the fact > that a thread sometimes takes the ILOCK but then hands the inode to a > workqueue to avoid overflowing the first thread's stack. That's why it > never got merged into the xfs tree. I see. Yeah, we do "interesting" dances around lockdep fs-freezing annotations for AIO as well where the freeze protection is inherited from submission to completion context (we effectively generate false release event for lockdep when exiting submit context and false acquire event in the completion context). It can be done but it's ugly and error prone. > However, that kind of switcheroo isn't done with the > MMAPLOCK/invalidate_lock, so you could simply pull the patch I linked > above into your series. OK, will do! Honza -- Jan Kara <jack@suse.com> SUSE Labs, CR
WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.cz> To: "Darrick J. Wong" <djwong@kernel.org> Cc: linux-cifs@vger.kernel.org, Damien Le Moal <damien.lemoal@wdc.com>, linux-ext4@vger.kernel.org, Jan Kara <jack@suse.cz>, "Darrick J. Wong" <darrick.wong@oracle.com>, Jeff Layton <jlayton@kernel.org>, Steve French <sfrench@samba.org>, Dave Chinner <david@fromorbit.com>, Matthew Wilcox <willy@infradead.org>, linux-f2fs-devel@lists.sourceforge.net, Christoph Hellwig <hch@infradead.org>, linux-mm@kvack.org, Miklos Szeredi <miklos@szeredi.hu>, Ted Tso <tytso@mit.edu>, linux-fsdevel@vger.kernel.org, Jaegeuk Kim <jaegeuk@kernel.org>, ceph-devel@vger.kernel.org, Johannes Thumshirn <jth@kernel.org>, Christoph Hellwig <hch@lst.de>, linux-xfs@vger.kernel.org Subject: Re: [f2fs-dev] [PATCH 07/13] xfs: Convert to use invalidate_lock Date: Thu, 27 May 2021 14:01:47 +0200 [thread overview] Message-ID: <20210527120147.GD24486@quack2.suse.cz> (raw) In-Reply-To: <20210526153251.GZ202121@locust> On Wed 26-05-21 08:32:51, Darrick J. Wong wrote: > On Wed, May 26, 2021 at 12:18:40PM +0200, Jan Kara wrote: > > On Tue 25-05-21 14:37:29, Darrick J. Wong wrote: > > > On Tue, May 25, 2021 at 03:50:44PM +0200, Jan Kara wrote: > > > > Use invalidate_lock instead of XFS internal i_mmap_lock. The intended > > > > purpose of invalidate_lock is exactly the same. Note that the locking in > > > > __xfs_filemap_fault() slightly changes as filemap_fault() already takes > > > > invalidate_lock. > > > > > > > > Reviewed-by: Christoph Hellwig <hch@lst.de> > > > > CC: <linux-xfs@vger.kernel.org> > > > > CC: "Darrick J. Wong" <darrick.wong@oracle.com> > > > > > > It's djwong@kernel.org now. > > > > OK, updated. > > > > > > @@ -355,8 +358,11 @@ xfs_isilocked( > > > > > > > > if (lock_flags & (XFS_MMAPLOCK_EXCL|XFS_MMAPLOCK_SHARED)) { > > > > if (!(lock_flags & XFS_MMAPLOCK_SHARED)) > > > > - return !!ip->i_mmaplock.mr_writer; > > > > - return rwsem_is_locked(&ip->i_mmaplock.mr_lock); > > > > + return !debug_locks || > > > > + lockdep_is_held_type( > > > > + &VFS_I(ip)->i_mapping->invalidate_lock, > > > > + 0); > > > > + return rwsem_is_locked(&VFS_I(ip)->i_mapping->invalidate_lock); > > > > > > This doesn't look right... > > > > > > If lockdep is disabled, we always return true for > > > xfs_isilocked(ip, XFS_MMAPLOCK_EXCL) even if nobody holds the lock? > > > > > > Granted, you probably just copy-pasted from the IOLOCK_SHARED clause > > > beneath it. Er... oh right, preichl was messing with all that... > > > > > > https://lore.kernel.org/linux-xfs/20201016021005.548850-2-preichl@redhat.com/ > > > > Indeed copy-paste programming ;) It certainly makes the assertions happy > > but useless. Should I pull the patch you reference into the series? It > > seems to have been uncontroversial and reviewed. Or will you pull the > > series to xfs tree so I can just rebase on top? > > The full conversion series introduced assertion failures because lockdep > can't handle some of the ILOCK usage patterns, specifically the fact > that a thread sometimes takes the ILOCK but then hands the inode to a > workqueue to avoid overflowing the first thread's stack. That's why it > never got merged into the xfs tree. I see. Yeah, we do "interesting" dances around lockdep fs-freezing annotations for AIO as well where the freeze protection is inherited from submission to completion context (we effectively generate false release event for lockdep when exiting submit context and false acquire event in the completion context). It can be done but it's ugly and error prone. > However, that kind of switcheroo isn't done with the > MMAPLOCK/invalidate_lock, so you could simply pull the patch I linked > above into your series. OK, will do! Honza -- Jan Kara <jack@suse.com> SUSE Labs, CR _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2021-05-27 12:01 UTC|newest] Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-25 13:50 [PATCH 0/13 v6] fs: Hole punch vs page cache filling races Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-25 13:50 ` [PATCH 01/13] mm: Fix comments mentioning i_mutex Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-25 13:50 ` [PATCH 02/13] documentation: Sync file_operations members with reality Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-25 20:43 ` Darrick J. Wong 2021-05-25 20:43 ` [f2fs-dev] " Darrick J. Wong 2021-05-25 13:50 ` [PATCH 03/13] mm: Protect operations adding pages to page cache with invalidate_lock Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-25 21:01 ` Darrick J. Wong 2021-05-25 21:01 ` [f2fs-dev] " Darrick J. Wong 2021-05-26 10:00 ` Jan Kara 2021-05-26 10:00 ` [f2fs-dev] " Jan Kara 2021-05-25 13:50 ` [PATCH 04/13] mm: Add functions to lock invalidate_lock for two mappings Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-25 20:48 ` Darrick J. Wong 2021-05-25 20:48 ` [f2fs-dev] " Darrick J. Wong 2021-05-26 10:07 ` Jan Kara 2021-05-26 10:07 ` [f2fs-dev] " Jan Kara 2021-05-26 12:11 ` Damien Le Moal 2021-05-26 12:11 ` [f2fs-dev] " Damien Le Moal 2021-05-26 12:11 ` Damien Le Moal 2021-05-26 13:45 ` Jan Kara 2021-05-26 13:45 ` [f2fs-dev] " Jan Kara 2021-05-26 13:45 ` Jan Kara 2021-05-26 15:25 ` Darrick J. Wong 2021-05-26 15:25 ` [f2fs-dev] " Darrick J. Wong 2021-05-26 15:25 ` Darrick J. Wong 2021-05-25 13:50 ` [PATCH 05/13] ext4: Convert to use mapping->invalidate_lock Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-25 13:50 ` [PATCH 06/13] ext2: Convert to using invalidate_lock Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-25 13:50 ` [PATCH 07/13] xfs: Convert to use invalidate_lock Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-25 21:37 ` Darrick J. Wong 2021-05-25 21:37 ` [f2fs-dev] " Darrick J. Wong 2021-05-26 10:18 ` Jan Kara 2021-05-26 10:18 ` [f2fs-dev] " Jan Kara 2021-05-26 15:32 ` Darrick J. Wong 2021-05-26 15:32 ` [f2fs-dev] " Darrick J. Wong 2021-05-27 12:01 ` Jan Kara [this message] 2021-05-27 12:01 ` Jan Kara 2021-05-25 21:40 ` Dave Chinner 2021-05-25 21:40 ` [f2fs-dev] " Dave Chinner 2021-05-26 10:20 ` Jan Kara 2021-05-26 10:20 ` [f2fs-dev] " Jan Kara 2021-05-26 13:42 ` Jan Kara 2021-05-26 13:42 ` [f2fs-dev] " Jan Kara 2021-05-25 13:50 ` [PATCH 08/13] xfs: Convert double locking of MMAPLOCK to use VFS helpers Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-25 21:41 ` Darrick J. Wong 2021-05-25 21:41 ` [f2fs-dev] " Darrick J. Wong 2021-05-25 13:50 ` [PATCH 09/13] zonefs: Convert to using invalidate_lock Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-25 13:50 ` [PATCH 10/13] f2fs: " Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-26 9:55 ` Chao Yu 2021-05-26 9:55 ` [f2fs-dev] " Chao Yu 2021-05-25 13:50 ` [PATCH 11/13] fuse: " Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-25 13:50 ` [PATCH 12/13] ceph: Fix race between hole punch and page fault Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara 2021-05-25 13:50 ` [PATCH 13/13] cifs: " Jan Kara 2021-05-25 13:50 ` [f2fs-dev] " Jan Kara
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=20210527120147.GD24486@quack2.suse.cz \ --to=jack@suse.cz \ --cc=ceph-devel@vger.kernel.org \ --cc=damien.lemoal@wdc.com \ --cc=darrick.wong@oracle.com \ --cc=david@fromorbit.com \ --cc=djwong@kernel.org \ --cc=hch@infradead.org \ --cc=hch@lst.de \ --cc=jaegeuk@kernel.org \ --cc=jlayton@kernel.org \ --cc=jth@kernel.org \ --cc=linux-cifs@vger.kernel.org \ --cc=linux-ext4@vger.kernel.org \ --cc=linux-f2fs-devel@lists.sourceforge.net \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=linux-xfs@vger.kernel.org \ --cc=miklos@szeredi.hu \ --cc=sfrench@samba.org \ --cc=tytso@mit.edu \ --cc=willy@infradead.org \ --cc=yuchao0@huawei.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.