dm: fix handling of multiple internal suspends
authorMikulas Patocka <mpatocka@redhat.com>
Thu, 8 Jan 2015 23:52:26 +0000 (18:52 -0500)
committerMike Snitzer <snitzer@redhat.com>
Sat, 24 Jan 2015 19:50:08 +0000 (14:50 -0500)
commit96b26c8c64c7a30488b8b404f7a63346df4c3bff
treed51619d0d63ab934cee6cda089531de56ed0e283
parenta59db67656021fa212e9b95a583f13c34eb67cd9
dm: fix handling of multiple internal suspends

Commit ffcc393641 ("dm: enhance internal suspend and resume interface")
attempted to handle multiple internal suspends on the same device, but
it did that incorrectly.  When these functions are called in this order
on the same device the device is no longer suspended, but it should be:
dm_internal_suspend_noflush
dm_internal_suspend_noflush
dm_internal_resume

Fix this bug by maintaining an 'internal_suspend_count' and resuming
the device when this count drops to zero.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm.c