3 stable fixes and 1 fix for a regression introduced during 3.19 merge:
- Fix inability to discard used space when the thin-pool target is in out-of-data-space mode and also transition the thin-pool back to write mode once free space is made available. - Fix DM core bio-based end_io bug that prevented proper post-processing of the error code returned from the block layer. - Fix crash in DM thin-pool due to thin device being added to the pool's active_thins list before properly initializing the thin device's refcount. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJUmGNyAAoJEMUj8QotnQNabvkIALCUey5p8mcK3nFlN+rK/e0m xJLIMCQKcqprygFlA7neg7CoE2Wypk2S/G4BI3gvMzkWstzul5JpmXzxXTklYnXi co65djg9sMHct3J3VKaX/X0hs8rdhXoiF9cz4f6RHuS5fyvSUMt+v6IlG0s4H3AQ iDfN8Nx6NF2wCdVUNAuhQHuefp9NmEo8gb3OQjrnSe8yLc2DPB2fmbJl/r7/GeIn VRCu38hZKx8f7kEfntwmC6BD45Icn2xNaP9grjZsy1pdfQzeb+03NOicy7A2NkqA pl88DRKb/bktNHVSqzL9a9Pf4qxEQU5wYRgI/b9ZVUY5b/QU66EW/NMoeSkdRHg= =zo19 -----END PGP SIGNATURE----- Merge tag 'dm-3.19-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm Pull device mapper fixes from Mike Snitzer: "Thre stable fixes and one fix for a regression introduced during 3.19 merge: - Fix inability to discard used space when the thin-pool target is in out-of-data-space mode and also transition the thin-pool back to write mode once free space is made available. - Fix DM core bio-based end_io bug that prevented proper post-processing of the error code returned from the block layer. - Fix crash in DM thin-pool due to thin device being added to the pool's active_thins list before properly initializing the thin device's refcount" * tag 'dm-3.19-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm: fix missed error code if .end_io isn't implemented by target_type dm thin: fix crash by initializing thin device's refcount and completion earlier dm thin: fix missing out-of-data-space to write mode transition if blocks are released dm thin: fix inability to discard blocks when in out-of-data-space mode
This commit is contained in:
Коммит
aa39477b56
|
@ -1127,6 +1127,24 @@ static void schedule_external_copy(struct thin_c *tc, dm_block_t virt_block,
|
|||
schedule_zero(tc, virt_block, data_dest, cell, bio);
|
||||
}
|
||||
|
||||
static void set_pool_mode(struct pool *pool, enum pool_mode new_mode);
|
||||
|
||||
static void check_for_space(struct pool *pool)
|
||||
{
|
||||
int r;
|
||||
dm_block_t nr_free;
|
||||
|
||||
if (get_pool_mode(pool) != PM_OUT_OF_DATA_SPACE)
|
||||
return;
|
||||
|
||||
r = dm_pool_get_free_block_count(pool->pmd, &nr_free);
|
||||
if (r)
|
||||
return;
|
||||
|
||||
if (nr_free)
|
||||
set_pool_mode(pool, PM_WRITE);
|
||||
}
|
||||
|
||||
/*
|
||||
* A non-zero return indicates read_only or fail_io mode.
|
||||
* Many callers don't care about the return value.
|
||||
|
@ -1141,6 +1159,8 @@ static int commit(struct pool *pool)
|
|||
r = dm_pool_commit_metadata(pool->pmd);
|
||||
if (r)
|
||||
metadata_operation_failed(pool, "dm_pool_commit_metadata", r);
|
||||
else
|
||||
check_for_space(pool);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -1159,8 +1179,6 @@ static void check_low_water_mark(struct pool *pool, dm_block_t free_blocks)
|
|||
}
|
||||
}
|
||||
|
||||
static void set_pool_mode(struct pool *pool, enum pool_mode new_mode);
|
||||
|
||||
static int alloc_data_block(struct thin_c *tc, dm_block_t *result)
|
||||
{
|
||||
int r;
|
||||
|
@ -2155,7 +2173,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode)
|
|||
pool->process_cell = process_cell_read_only;
|
||||
pool->process_discard_cell = process_discard_cell;
|
||||
pool->process_prepared_mapping = process_prepared_mapping;
|
||||
pool->process_prepared_discard = process_prepared_discard_passdown;
|
||||
pool->process_prepared_discard = process_prepared_discard;
|
||||
|
||||
if (!pool->pf.error_if_no_space && no_space_timeout)
|
||||
queue_delayed_work(pool->wq, &pool->no_space_timeout, no_space_timeout);
|
||||
|
@ -3814,6 +3832,8 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv)
|
|||
r = -EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
atomic_set(&tc->refcount, 1);
|
||||
init_completion(&tc->can_destroy);
|
||||
list_add_tail_rcu(&tc->list, &tc->pool->active_thins);
|
||||
spin_unlock_irqrestore(&tc->pool->lock, flags);
|
||||
/*
|
||||
|
@ -3826,9 +3846,6 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv)
|
|||
|
||||
dm_put(pool_md);
|
||||
|
||||
atomic_set(&tc->refcount, 1);
|
||||
init_completion(&tc->can_destroy);
|
||||
|
||||
return 0;
|
||||
|
||||
bad:
|
||||
|
|
|
@ -899,7 +899,7 @@ static void disable_write_same(struct mapped_device *md)
|
|||
|
||||
static void clone_endio(struct bio *bio, int error)
|
||||
{
|
||||
int r = 0;
|
||||
int r = error;
|
||||
struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone);
|
||||
struct dm_io *io = tio->io;
|
||||
struct mapped_device *md = tio->io->md;
|
||||
|
|
Загрузка…
Ссылка в новой задаче