Chris, On Fri, 13 Jul 2012, Chris Mason wrote: > On Wed, Jul 11, 2012 at 11:47:40PM -0600, Mike Galbraith wrote: > > Greetings, > > [ deadlocks with btrfs and the recent RT kernels ] > > I talked with Thomas about this and I think the problem is the > single-reader nature of the RW rwlocks. The lockdep report below > mentions that btrfs is calling: > > > [ 692.963099] [<ffffffff811fabd2>] btrfs_clear_path_blocking+0x32/0x70 > > In this case, the task has a number of blocking read locks on the btrfs buffers, > and we're trying to turn them back into spinning read locks. Even > though btrfs is taking the read rwlock, it doesn't think of this as a new > lock operation because we were blocking out new writers. > > If the second task has taken the spinning read lock, it is going to > prevent that clear_path_blocking operation from progressing, even though > it would have worked on a non-RT kernel. > > The solution should be to make the blocking read locks in btrfs honor the > single-reader semantics. This means not allowing more than one blocking > reader and not allowing a spinning reader when there is a blocking > reader. Strictly speaking btrfs shouldn't need recursive readers on a > single lock, so I wouldn't worry about that part. > > There is also a chunk of code in btrfs_clear_path_blocking that makes > sure to strictly honor top down locking order during the conversion. It > only does this when lockdep is enabled because in non-RT kernels we > don't need to worry about it. For RT we'll want to enable that as well. thanks for explaining this. I really got lost in that code completely. > I'll give this a shot later today. Cool. Aside of that I'm still pondering to experiment with a non-pi variant of rw locks which allows multiple readers. For such cases as btrfs I think they would be well suited and avoid the performance overhead of the single writer restriction. But that's not going to happen before my vacation, so we'll stick with your workaround for now and let Mike beat the hell out of it. Thanks, Thomas -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html