On Thu, Aug 02, 2012 at 08:11:58AM -0400, Josef Bacik wrote: > On Thu, Aug 02, 2012 at 04:46:44AM -0600, Liu Bo wrote: > > On 08/02/2012 04:25 AM, Josef Bacik wrote: > > > We need an smb_mb() before waitqueue_active to avoid missing wakeups. > > > Before Mitch was hitting a deadlock between the ordered flushers and the > > > transaction commit because the ordered flushers were waiting for more refs > > > and were never woken up, so those smp_mb()'s are the most important. > > > Everything else I added for correctness sake and to avoid getting bitten > > > by > > > this again somewhere else. Thanks, > > > > I'll appreciate a lot if you can add some comments for each memory > > barrier, because not everyone knows why it is used here and there. :) > > I'm not going to add comments to all those places, you need a memory barrier > in > places you don't have an implicit barrier before you do waitqueue_active > because > you could miss somebody being added to the waitqueue, it's just basic > correctness. Thanks,
This asks for a helper: + smp_mb(); + if (waitqueue_active(&fs_info->async_submit_wait)) + wake_up(&fs_info->async_submit_wait); -> void wake_up_if_active(wait) { /* * the comment */ smp_mb(); if(waitqueue_active(wait) wake_up(wait); } -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html