Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+24 -7
+23 -6
drivers/md/dm-thin.c
··· 1127 1127 schedule_zero(tc, virt_block, data_dest, cell, bio); 1128 1128 } 1129 1129 1130 + static void set_pool_mode(struct pool *pool, enum pool_mode new_mode); 1131 + 1132 + static void check_for_space(struct pool *pool) 1133 + { 1134 + int r; 1135 + dm_block_t nr_free; 1136 + 1137 + if (get_pool_mode(pool) != PM_OUT_OF_DATA_SPACE) 1138 + return; 1139 + 1140 + r = dm_pool_get_free_block_count(pool->pmd, &nr_free); 1141 + if (r) 1142 + return; 1143 + 1144 + if (nr_free) 1145 + set_pool_mode(pool, PM_WRITE); 1146 + } 1147 + 1130 1148 /* 1131 1149 * A non-zero return indicates read_only or fail_io mode. 1132 1150 * Many callers don't care about the return value. ··· 1159 1141 r = dm_pool_commit_metadata(pool->pmd); 1160 1142 if (r) 1161 1143 metadata_operation_failed(pool, "dm_pool_commit_metadata", r); 1144 + else 1145 + check_for_space(pool); 1162 1146 1163 1147 return r; 1164 1148 } ··· 1178 1158 dm_table_event(pool->ti->table); 1179 1159 } 1180 1160 } 1181 - 1182 - static void set_pool_mode(struct pool *pool, enum pool_mode new_mode); 1183 1161 1184 1162 static int alloc_data_block(struct thin_c *tc, dm_block_t *result) 1185 1163 { ··· 2173 2155 pool->process_cell = process_cell_read_only; 2174 2156 pool->process_discard_cell = process_discard_cell; 2175 2157 pool->process_prepared_mapping = process_prepared_mapping; 2176 - pool->process_prepared_discard = process_prepared_discard_passdown; 2158 + pool->process_prepared_discard = process_prepared_discard; 2177 2159 2178 2160 if (!pool->pf.error_if_no_space && no_space_timeout) 2179 2161 queue_delayed_work(pool->wq, &pool->no_space_timeout, no_space_timeout); ··· 3832 3814 r = -EINVAL; 3833 3815 goto bad; 3834 3816 } 3817 + atomic_set(&tc->refcount, 1); 3818 + init_completion(&tc->can_destroy); 3835 3819 list_add_tail_rcu(&tc->list, &tc->pool->active_thins); 3836 3820 spin_unlock_irqrestore(&tc->pool->lock, flags); 3837 3821 /* ··· 3845 3825 synchronize_rcu(); 3846 3826 3847 3827 dm_put(pool_md); 3848 - 3849 - atomic_set(&tc->refcount, 1); 3850 - init_completion(&tc->can_destroy); 3851 3828 3852 3829 return 0; 3853 3830
+1 -1
drivers/md/dm.c
··· 899 899 900 900 static void clone_endio(struct bio *bio, int error) 901 901 { 902 - int r = 0; 902 + int r = error; 903 903 struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone); 904 904 struct dm_io *io = tio->io; 905 905 struct mapped_device *md = tio->io->md;