This is a note to let you know that I've just added the patch titled

    dm thin: fix the error path for the thin device constructor

to the 3.13-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     dm-thin-fix-the-error-path-for-the-thin-device-constructor.patch
and it can be found in the queue-3.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 1acacc0784aab45627b6009e0e9224886279ac0b Mon Sep 17 00:00:00 2001
From: Mike Snitzer <[email protected]>
Date: Wed, 19 Feb 2014 20:32:33 -0500
Subject: dm thin: fix the error path for the thin device constructor

From: Mike Snitzer <[email protected]>

commit 1acacc0784aab45627b6009e0e9224886279ac0b upstream.

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 <[email protected]>
Acked-by: Joe Thornber <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/md/dm-thin.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2848,6 +2848,7 @@ static int thin_ctr(struct dm_target *ti
 
        if (get_pool_mode(tc->pool) == PM_FAIL) {
                ti->error = "Couldn't open thin device, Pool is in fail mode";
+               r = -EINVAL;
                goto bad_thin_open;
        }
 
@@ -2859,7 +2860,7 @@ static int thin_ctr(struct dm_target *ti
 
        r = dm_set_target_max_io_len(ti, tc->pool->sectors_per_block);
        if (r)
-               goto bad_thin_open;
+               goto bad_target_max_io_len;
 
        ti->num_flush_bios = 1;
        ti->flush_supported = true;
@@ -2880,6 +2881,8 @@ static int thin_ctr(struct dm_target *ti
 
        return 0;
 
+bad_target_max_io_len:
+       dm_pool_close_thin_device(tc->td);
 bad_thin_open:
        __pool_dec(tc->pool);
 bad_pool_lookup:


Patches currently in stable-queue which might be from [email protected] are

queue-3.13/dm-mpath-fix-stalls-when-handling-invalid-ioctls.patch
queue-3.13/dm-thin-avoid-metadata-commit-if-a-pool-s-thin-devices-haven-t-changed.patch
queue-3.13/dm-thin-fix-the-error-path-for-the-thin-device-constructor.patch
queue-3.13/dm-cache-move-hook_info-into-common-portion-of-per_bio_data-structure.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to