summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2017-04-27 19:11:21 +0200
committerMike Snitzer <snitzer@redhat.com>2017-04-27 23:08:42 +0200
commit1ea0654e46eb62acc379000be2f16350101ebf85 (patch)
tree52dceb575d77441dbbd2a5a2ec9f56f54304a2bc /drivers/md/dm.c
parentdm block manager: remove an unused argument from dm_block_manager_create() (diff)
downloadlinux-1ea0654e46eb62acc379000be2f16350101ebf85.tar.xz
linux-1ea0654e46eb62acc379000be2f16350101ebf85.zip
dm: verify suspend_locking assumptions at runtime
Ensure that the assumptions about the caller holding suspend_lock are checked at runtime if lockdep is enabled. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index e602ae0d5d75..9940c9a42665 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1698,6 +1698,8 @@ static void event_callback(void *context)
*/
static void __set_size(struct mapped_device *md, sector_t size)
{
+ lockdep_assert_held(&md->suspend_lock);
+
set_capacity(md->disk, size);
i_size_write(md->bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
@@ -2147,8 +2149,6 @@ static void unlock_fs(struct mapped_device *md)
* If __dm_suspend returns 0, the device is completely quiescent
* now. There is no request-processing activity. All new requests
* are being added to md->deferred list.
- *
- * Caller must hold md->suspend_lock
*/
static int __dm_suspend(struct mapped_device *md, struct dm_table *map,
unsigned suspend_flags, long task_state,
@@ -2364,6 +2364,8 @@ static void __dm_internal_suspend(struct mapped_device *md, unsigned suspend_fla
{
struct dm_table *map = NULL;
+ lockdep_assert_held(&md->suspend_lock);
+
if (md->internal_suspend_count++)
return; /* nested internal suspend */