dm thin: fix the error path for the thin device constructor
authorMike Snitzer <snitzer@redhat.com>
Thu, 20 Feb 2014 01:32:33 +0000 (20:32 -0500)
committerMike Snitzer <snitzer@redhat.com>
Mon, 24 Feb 2014 16:41:18 +0000 (11:41 -0500)
commit1acacc0784aab45627b6009e0e9224886279ac0b
treedd1b3ce2e1bd51c2b81a7d3d4b0d066fa09bac10
parentf3a44fe0608eb628e1f8f6e3540462e6d171a745
dm thin: fix the error path for the thin device constructor

dm_pool_close_thin_device() must be called if dm_set_target_max_io_len()
fails in thin_ctr().  Otherwise __pool_destroy() will fail because the
pool will still have an open thin device:

 device-mapper: thin metadata: attempt to close pmd when 1 device(s) are still open
 device-mapper: thin: __pool_destroy: dm_pool_metadata_close() failed.

Also, must establish error code if failing thin_ctr() because the pool
is in fail_io mode.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Joe Thornber <ejt@redhat.com>
Cc: stable@vger.kernel.org
drivers/md/dm-thin.c