xfs
[Top] [All Lists]

Re: [PATCH, RFC] xfs: remove i_iolock and use i_rwsem in the VFS inode i

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH, RFC] xfs: remove i_iolock and use i_rwsem in the VFS inode instead
From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Date: Thu, 8 Sep 2016 08:54:42 +0200
Cc: Christoph Hellwig <hch@xxxxxx>, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20160907214536.GQ30056@dastard>
References: <1470935423-12329-1-git-send-email-hch@xxxxxx> <20160811234335.GX16044@dastard> <20160812025026.GA975@xxxxxx> <20160812095813.GZ16044@dastard> <20160905151529.GB16726@xxxxxx> <20160907214536.GQ30056@dastard>
User-agent: Mutt/1.5.23.1 (2014-03-12)
On Thu, Sep 08, 2016 at 07:45:36AM +1000, Dave Chinner wrote:
> On Mon, Sep 05, 2016 at 05:15:29PM +0200, Christoph Hellwig wrote:
> > Hi Dave,
> > 
> > I looked into killing the mrlock and ran into an unexpected problem.
> > 
> > Currently mr_writer tracks that there is someone holding a write lock,
> > lockdep on the other hand checks if the calling thread has that lock.
> > 
> > While that generally is the right semantic, our hack to offload
> > btree splits to a work item offends lockdep.  E.g. this callstack
> > now asserts:
> 
> It's a semaphore, not a mutex. Semaphore locking is independent of
> task context, the lock follows the object it protects, not the task
> that took the lock. i.e. Lockdep is wrong to assume the "owner" of a
> rw_sem will not change between lock and unlock.

We've added strict owner semantics to rwsem a long time ago.

If you want the actual semaphore semantics (which we greatly discourage,
because you cannot do validation on it) you should use
{down,up}_read_non_owner().

I'm not sure we've got write_non_owner() variants for this.

Turns out, there really are very few 'semaphore' users.

<Prev in Thread] Current Thread [Next in Thread>