Fix occasional hangs on mutexes
authorJan Kara <jack@suse.cz>
Tue, 24 May 2016 15:03:22 +0000 (17:03 +0200)
committerJens Axboe <axboe@fb.com>
Wed, 25 May 2016 19:22:30 +0000 (13:22 -0600)
commitf9e5b5ee74e8282199eda9318865ffdc7645a384
tree7ba1e7e593e19cb8f84f1aaafed9b49e22942e01
parentd7982dd0ab2a1a315b5f9859c67a02414ce6274f
Fix occasional hangs on mutexes

When running xfstest generic/299 using fio on my test machine using
ramdisk as a backing store, I have noticed that fio often hangs waiting
for td->io_u_lock. After some debugging I have found out the reason is
that mutexes are created as process-private by default and but this
mutex is actually manipulated from several processes. The hang is not
obvious immediately as the mutex is located in shared memory and thus
while the locking is resolved in userspace, everything works as
expected. Only once we use kernel futexes, the process is not properly
woken up when futex is released.

Fix the problem by marking all mutexes and conditional variables that
are located in shared memory as shared.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
backend.c
helper_thread.c
iolog.c
workqueue.c