Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 24e19d2

Browse files
committed
Merge tag 'dm-3.15-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device-mapper fixes from Mike Snitzer: "A dm-cache stable fix to split discards on cache block boundaries because dm-cache cannot yet handle discards that span cache blocks. Really fix a dm-mpath LOCKDEP warning that was introduced in -rc1. Add a 'no_space_timeout' control to dm-thinp to restore the ability to queue IO indefinitely when no data space is available. This fixes a change in behavior that was introduced in -rc6 where the timeout couldn't be disabled" * tag 'dm-3.15-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm mpath: really fix lockdep warning dm cache: always split discards on cache block boundaries dm thin: add 'no_space_timeout' dm-thin-pool module param
2 parents 6538b8e + 63d832c commit 24e19d2

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

Documentation/device-mapper/thin-provisioning.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,10 @@ ii) Status
309309
error_if_no_space|queue_if_no_space
310310
If the pool runs out of data or metadata space, the pool will
311311
either queue or error the IO destined to the data device. The
312-
default is to queue the IO until more space is added.
312+
default is to queue the IO until more space is added or the
313+
'no_space_timeout' expires. The 'no_space_timeout' dm-thin-pool
314+
module parameter can be used to change this timeout -- it
315+
defaults to 60 seconds but may be disabled using a value of 0.
313316

314317
iii) Messages
315318

drivers/md/dm-cache-target.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,6 +2178,8 @@ static int cache_create(struct cache_args *ca, struct cache **result)
21782178
ti->num_discard_bios = 1;
21792179
ti->discards_supported = true;
21802180
ti->discard_zeroes_data_unsupported = true;
2181+
/* Discard bios must be split on a block boundary */
2182+
ti->split_discard_bios = true;
21812183

21822184
cache->features = ca->features;
21832185
ti->per_bio_data_size = get_per_bio_data_size(cache);

drivers/md/dm-mpath.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,11 @@ static int queue_if_no_path(struct multipath *m, unsigned queue_if_no_path,
445445
else
446446
m->saved_queue_if_no_path = queue_if_no_path;
447447
m->queue_if_no_path = queue_if_no_path;
448-
if (!m->queue_if_no_path)
449-
dm_table_run_md_queue_async(m->ti->table);
450-
451448
spin_unlock_irqrestore(&m->lock, flags);
452449

450+
if (!queue_if_no_path)
451+
dm_table_run_md_queue_async(m->ti->table);
452+
453453
return 0;
454454
}
455455

@@ -954,7 +954,7 @@ static int fail_path(struct pgpath *pgpath)
954954
*/
955955
static int reinstate_path(struct pgpath *pgpath)
956956
{
957-
int r = 0;
957+
int r = 0, run_queue = 0;
958958
unsigned long flags;
959959
struct multipath *m = pgpath->pg->m;
960960

@@ -978,7 +978,7 @@ static int reinstate_path(struct pgpath *pgpath)
978978

979979
if (!m->nr_valid_paths++) {
980980
m->current_pgpath = NULL;
981-
dm_table_run_md_queue_async(m->ti->table);
981+
run_queue = 1;
982982
} else if (m->hw_handler_name && (m->current_pg == pgpath->pg)) {
983983
if (queue_work(kmpath_handlerd, &pgpath->activate_path.work))
984984
m->pg_init_in_progress++;
@@ -991,6 +991,8 @@ static int reinstate_path(struct pgpath *pgpath)
991991

992992
out:
993993
spin_unlock_irqrestore(&m->lock, flags);
994+
if (run_queue)
995+
dm_table_run_md_queue_async(m->ti->table);
994996

995997
return r;
996998
}
@@ -1566,8 +1568,8 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd,
15661568
}
15671569
if (m->pg_init_required)
15681570
__pg_init_all_paths(m);
1569-
dm_table_run_md_queue_async(m->ti->table);
15701571
spin_unlock_irqrestore(&m->lock, flags);
1572+
dm_table_run_md_queue_async(m->ti->table);
15711573
}
15721574

15731575
return r ? : __blkdev_driver_ioctl(bdev, mode, cmd, arg);

drivers/md/dm-thin.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
#define MAPPING_POOL_SIZE 1024
2828
#define PRISON_CELLS 1024
2929
#define COMMIT_PERIOD HZ
30-
#define NO_SPACE_TIMEOUT (HZ * 60)
30+
#define NO_SPACE_TIMEOUT_SECS 60
31+
32+
static unsigned no_space_timeout_secs = NO_SPACE_TIMEOUT_SECS;
3133

3234
DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(snapshot_copy_throttle,
3335
"A percentage of time allocated for copy on write");
@@ -1670,6 +1672,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode)
16701672
struct pool_c *pt = pool->ti->private;
16711673
bool needs_check = dm_pool_metadata_needs_check(pool->pmd);
16721674
enum pool_mode old_mode = get_pool_mode(pool);
1675+
unsigned long no_space_timeout = ACCESS_ONCE(no_space_timeout_secs) * HZ;
16731676

16741677
/*
16751678
* Never allow the pool to transition to PM_WRITE mode if user
@@ -1732,8 +1735,8 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode)
17321735
pool->process_prepared_mapping = process_prepared_mapping;
17331736
pool->process_prepared_discard = process_prepared_discard_passdown;
17341737

1735-
if (!pool->pf.error_if_no_space)
1736-
queue_delayed_work(pool->wq, &pool->no_space_timeout, NO_SPACE_TIMEOUT);
1738+
if (!pool->pf.error_if_no_space && no_space_timeout)
1739+
queue_delayed_work(pool->wq, &pool->no_space_timeout, no_space_timeout);
17371740
break;
17381741

17391742
case PM_WRITE:
@@ -3508,6 +3511,9 @@ static void dm_thin_exit(void)
35083511
module_init(dm_thin_init);
35093512
module_exit(dm_thin_exit);
35103513

3514+
module_param_named(no_space_timeout, no_space_timeout_secs, uint, S_IRUGO | S_IWUSR);
3515+
MODULE_PARM_DESC(no_space_timeout, "Out of data space queue IO timeout in seconds");
3516+
35113517
MODULE_DESCRIPTION(DM_NAME " thin provisioning target");
35123518
MODULE_AUTHOR("Joe Thornber <[email protected]>");
35133519
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)