dm thin: fix a race in thin_dtr
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 5 Nov 2014 22:00:13 +0000 (17:00 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2015 18:27:46 +0000 (10:27 -0800)
commit1a6f39233d864d62c6f26cda68df404d814baf4c
tree761c75f9516a8b61d02c84e6c157bd565b5d3280
parent63027d8810ee41ebb92d183c2e95ee620f8503cb
dm thin: fix a race in thin_dtr

commit 17181fb7a0c3a279196c0eeb2caba65a1519614b upstream.

As long as struct thin_c is in the list, anyone can grab a reference of
it.  Consequently, we must wait for the reference count to drop to zero
*after* we remove the structure from the list, not before.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-thin.c