]> www.infradead.org Git - users/jedix/linux-maple.git/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)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 26 May 2016 22:46:20 +0000 (15:46 -0700)
commit32af85557d8d214e77bb144d4705194b37368f01
tree7e0e6dfb8c29fab4927cae939c7e546d50016725
parent567a5f737d49fe14518eb27a9d414aabfea90dfd
bcache: fix race of writeback thread starting before complete initialization

Orabug: stable_rc4

[ 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>
(cherry picked from commit 7269554a57352f66aefb3e85cb7e11c4b63bba59)

Signed-off-by: Dan Duval <dan.duval@oracle.com>
drivers/md/bcache/super.c