From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Pavel Reichl <preichl@redhat.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH v7 0/4] xfs: Remove wrappers for some semaphores
Date: Mon, 23 Mar 2020 09:49:42 -0700 [thread overview]
Message-ID: <20200323164942.GA30433@infradead.org> (raw)
In-Reply-To: <20200323163342.GD29339@magnolia>
On Mon, Mar 23, 2020 at 09:33:42AM -0700, Darrick J. Wong wrote:
> lockdep tracks the rwsem's lock state /and/ which process actually
> holds the rwsem. This ownership doesn't transfer from 28177 to 27081,
> so when the kworker asks lockdep if it holds ILOCK_EXCL, lockdep says
> no, because 27081 doesn't own the lock, 28177 does. Kaboom.
> The old mrlock_t had that 'int mr_writer' field which didn't care about
> lock ownership and so isilocked would return true and so the assert was
> happy.
>
> So now comes the fun part -- the old isilocked code had a glaring hole
> in which it would return true if *anyone* held the lock, even if the
> owner is some other unrelated thread. That's probably good enough for
> most of the fstests because we generally only run one thread at a time,
> and developers will probably notice. :)
>
> However, with your series applied, the isilocked function becomes much
> more powerful when lockdep is active because now we can test that the
> lock is held *by the caller*, which closes that hole.
>
> Unfortunately, it also trips over this bmap split case, so if there's a
> way to solve that problem we'd better find it quickly. Unfortunately, I
> don't know of a way to gift a lock to another thread temporarily...
>
> Thoughts?
lock_release() in the donor, lock_acquire in the worker context, and
vice versa on return. We already do that dance indirectly with
xfs_setfilesize_trans_alloc and friends.
next prev parent reply other threads:[~2020-03-23 16:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 21:03 [PATCH v7 0/4] xfs: Remove wrappers for some semaphores Pavel Reichl
2020-03-20 21:03 ` [PATCH v7 1/4] xfs: Refactor xfs_isilocked() Pavel Reichl
2020-03-20 21:03 ` [PATCH v7 2/4] xfs: clean up whitespace in xfs_isilocked() calls Pavel Reichl
2020-03-20 21:03 ` [PATCH v7 3/4] xfs: xfs_isilocked() can only check a single lock type Pavel Reichl
2020-03-20 21:03 ` [PATCH v7 4/4] xfs: replace mrlock_t with rw_semaphores Pavel Reichl
2020-03-23 3:28 ` [PATCH v7 0/4] xfs: Remove wrappers for some semaphores Darrick J. Wong
2020-03-23 9:22 ` Pavel Reichl
2020-03-23 16:33 ` Darrick J. Wong
2020-03-23 16:49 ` Christoph Hellwig [this message]
2020-03-23 21:59 ` Dave Chinner
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=20200323164942.GA30433@infradead.org \
--to=hch@infradead.org \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=preichl@redhat.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).