Re: Observed deadlock in ext4 under 3.2.23-rt37 & 3.2.33-rt50
From: Theodore Ts'o <tytso@mit.edu>
Date: 2013-01-03 15:36:44
On Thu, Jan 03, 2013 at 08:36:39AM -0600, Staffan Tjernstrom wrote:
This may be completely off-in-newbie land, but I figured I'd throw in what I think I've tracked down. It looks as if there was a fairly recent patch to turn locks in parts of the code into atomic instructions (apologies - I don't have the patch id to hand atm) in do_get_write_access() amongst others.
In fs/jbd2/transaction.c? Can you give me the code snippit and/or function and line number that you're concerned about?
Then in turn the C++ standard library loops around calls to write() whilst access isn't available, basically blocking on the atomic (which then in turn doesn't support priority inheritance), causing the wait loop.
Yeah, but do_get_write_access() blocks (usually waiting for the jbd2 kernel thread to complete, but possibly on a memory allocation); we don't return EAGAIN or anything like that. So I don't see how that would cause a wait loop. It's possible we could be returning -ENOMEM; are you looping for all write failures, or just for EAGAIN/EINTR and partial writes? - Ted