Skip to contentSkip to conversation

2.6.18.4: flush_workqueue calls mutex_lock in interrupt environment

DISCUSSION Chen, Kenneth W 1 participant 1 message Dec 15, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Andrew Morton wrote on Thursday, December 14, 2006 5:20 PM

Quoted 20 lines

it's hard to disagree.

Begin forwarded message:

Quoted 11 lines · xb
Quoted 10 lines

Hi all,

Running some IO stress tests on a 8*ways IA64 platform, we got:

     BUG: warning at kernel/mutex.c:132/__mutex_lock_common()  message
followed by:
     Unable to handle kernel paging request at virtual address

0000000000200200
oops corresponding to anon_vma_unlink() calling list_del() on a poisonned list.

Quoted 5 lines
Quoted 2 lines

Having a look to the stack, we see that flush_workqueue() calls mutex_lock() with softirqs disabled.

something is wrong here... flush_workqueue() is a sleeping function and is not allowed to be called in such a context!

Quoted 7 lines

It seems utterly insane to have aio_complete() flush a workqueue. That function has to be called from a number of different environments, including non-sleep tolerant environments.

For instance it means that directIO on NFS will now cause the rpciod workqueues to call flush_workqueue(aio_wq), thus slowing down all RPC activity.

The bug appears to be somewhere else, somehow the ref count on ioctx is all messed up.

In aio_complete, __put_ioctx() should not be invoked because ref count on ioctx is supposedly more than 2, aio_complete decrement it once and should return without invoking the free function.

The real freeing ioctx should be coming from exit_aio() or io_destroy(), in which case both wait until no further pending AIO request via wait_for_all_aios().

- Ken