Thread (39 messages) 39 messages, 10 authors, 2020-02-12

Re: RFC: hold i_rwsem until aio completes

From: Waiman Long <longman@redhat.com>
Date: 2020-01-15 19:03:34
Also in: linux-ext4, linux-fsdevel, linux-xfs, lkml

On 1/15/20 9:49 AM, Jason Gunthorpe wrote:
On Wed, Jan 15, 2020 at 03:33:47PM +0100, Peter Zijlstra wrote:
quoted
On Wed, Jan 15, 2020 at 09:24:28AM -0400, Jason Gunthorpe wrote:
quoted
I was interested because you are talking about allowing the read/write side
of a rw sem to be held across a return to user space/etc, which is the
same basic problem.
No it is not; allowing the lock to be held across userspace doesn't
change the owner. This is a crucial difference, PI depends on there
being a distinct owner. That said, allowing the lock to be held across
userspace still breaks PI in that it completely wrecks the ability to
analyze the critical section.
I'm not sure what you are contrasting?

I was remarking that I see many places open code a rwsem using an
atomic and a completion specifically because they need to do the
things Christoph identified:
quoted
(1) no unlocking by another process than the one that acquired it
(2) no return to userspace with locks held
As an example flow: obtain the read side lock, schedual a work queue,
return to user space, and unlock the read side from the work queue.
We currently have down_read_non_owner() and up_read_non_owner() that
perform the lock and unlock without lockdep tracking. Of course, that is
a hack and their use must be carefully scrutinized to make sure that
there is no deadlock or other potentially locking issues.

Cheers,
Longman

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help