]> git.karo-electronics.de Git - karo-tx-linux.git/commit
block: prevent race/cleanup
authorDerek Basehore <dbasehore@chromium.org>
Tue, 18 Dec 2012 20:27:20 +0000 (12:27 -0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 19 Dec 2012 19:36:10 +0000 (20:36 +0100)
commit12c2bdb232168511c8dd54d6626549391a228918
tree8b9179df57d7ddd596a57d465cce4e0949795d25
parentaea24a8bbc81c8b404e4e293fb37aefaf388d35d
block: prevent race/cleanup

Remove a race condition which causes a warning in disk_clear_events.  This
is a race between disk_clear_events() and disk_flush_events().
ev->clearing will be altered by disk_flush_events() even though we are
blocking event checking through disk_flush_events().  If this happens
after ev->clearing was cleared for disk_clear_events(), this can cause the
WARN_ON_ONCE() in that function to be triggered.

This change also has disk_clear_events() not go through a workqueue.
Since we have to wait for the work to complete, we should just call the
function directly.  Also, since this work cannot be put on a freezable
workqueue, it will have to contend with increased demand, so calling the
function directly avoids this.

[akpm@linux-foundation.org: fix spello in comment]
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Cc: Mandeep Singh Baines <msb@chromium.org>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/genhd.c