]> git.itanic.dy.fi Git - linux-stable/commit
bcache: fix race of writeback thread starting before complete initialization
authorEric Wheeler <git@linux.ewheeler.net>
Fri, 26 Feb 2016 22:39:06 +0000 (14:39 -0800)
committerSasha Levin <sasha.levin@oracle.com>
Mon, 18 Apr 2016 12:49:25 +0000 (08:49 -0400)
commitc2f87b5d704608a0ca412d511ff2ca8b7eb1ff36
treeda0ba4666056ed481e6e2426cb4d34484671182e
parente62daff6d23932a38b45f005ba4736bdf230ff84
bcache: fix race of writeback thread starting before complete initialization

[ Upstream commit 07cc6ef8edc47f8b4fc1e276d31127a0a5863d4d ]

The bch_writeback_thread might BUG_ON in read_dirty() if
dc->sb==BDEV_STATE_DIRTY and bch_sectors_dirty_init has not yet completed
its related initialization.  This patch downs the dc->writeback_lock until
after initialization is complete, thus preventing bch_writeback_thread
from proceeding prematurely.

See this thread:
  http://thread.gmane.org/gmane.linux.kernel.bcache.devel/3453

Signed-off-by: Eric Wheeler <bcache@linux.ewheeler.net>
Tested-by: Marc MERLIN <marc@merlins.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/md/bcache/super.c