On Thu, 2011-04-07 at 16:19 +1000, Dave Chinner wrote: > From: Dave Chinner <dchinner@xxxxxxxxxx> > > Recetn attempts to use writeback_inode_sb_nr_if_idle() in XFs from > memory reclaim context have caused deadlocks because memory reclaim > call be called from a failed allocation during forking a flusher > thread. The shrinker then attempts to trigger writeback and the bdi > is considered idle because writeback is not in progress yet and then > deadlocks because bdi_queue_work() blocks waiting for the > BDI_Pending bit to clear which will never happen because it needs > the fork to complete. > > To avoid this deadlock, consider writeback to be in progress if the > flusher thread is being created. This prevents reclaim from blocking > waiting for it be forked and hence avoids the deadlock. I don't believe it matters, but BDI_pending is also set while a writeback flusher thread is being shut down. In any case, a handy use of that flag bit. Reviewed-by: Alex Elder <aelder@xxxxxxx> > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> -- 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