dm cache: fix a race condition between queuing new migrations and quiescing for a...
authorJoe Thornber <ejt@redhat.com>
Wed, 30 Oct 2013 17:11:58 +0000 (17:11 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Dec 2013 18:56:43 +0000 (10:56 -0800)
commit8fafee9829f539e17ea8678a6f56d2b897ffe3cc
treef0b37c8a1aac5669952fba34b1c2020db3642365
parent0c5fd99e89b5f288ffe5c2ed301d2ffaac091891
dm cache: fix a race condition between queuing new migrations and quiescing for a shutdown

commit 66cb1910df17b38334153462ec8166e48058035f upstream.

The code that was trying to do this was inadequate.  The postsuspend
method (in ioctl context), needs to wait for the worker thread to
acknowledge the request to quiesce.  Otherwise the migration count may
drop to zero temporarily before the worker thread realises we're
quiescing.  In this case the target will be taken down, but the worker
thread may have issued a new migration, which will cause an oops when
it completes.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-cache-target.c