[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210526153251.GZ202121@locust>
Date: Wed, 26 May 2021 08:32:51 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: Jan Kara <jack@...e.cz>
Cc: linux-fsdevel@...r.kernel.org,
Christoph Hellwig <hch@...radead.org>,
Dave Chinner <david@...morbit.com>, ceph-devel@...r.kernel.org,
Chao Yu <yuchao0@...wei.com>,
Damien Le Moal <damien.lemoal@....com>,
"Darrick J. Wong" <darrick.wong@...cle.com>,
Jaegeuk Kim <jaegeuk@...nel.org>,
Jeff Layton <jlayton@...nel.org>,
Johannes Thumshirn <jth@...nel.org>,
linux-cifs@...r.kernel.org, linux-ext4@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net, linux-mm@...ck.org,
linux-xfs@...r.kernel.org, Miklos Szeredi <miklos@...redi.hu>,
Steve French <sfrench@...ba.org>, Ted Tso <tytso@....edu>,
Matthew Wilcox <willy@...radead.org>,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH 07/13] xfs: Convert to use invalidate_lock
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@....de>
> > > CC: <linux-xfs@...r.kernel.org>
> > > CC: "Darrick J. Wong" <darrick.wong@...cle.com>
> >
> > It's djwong@...nel.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.
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.
--D
>
> Honza
> --
> Jan Kara <jack@...e.com>
> SUSE Labs, CR
Powered by blists - more mailing lists