Skip to content

Commit d632ab8

Browse files
committed
Merge tag 'for-6.17/dm-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper updates from Mikulas Patocka: - fix checking for request-based stackable devices (dm-table) - fix corrupt_bio_byte setup checks (dm-flakey) - add support for resync w/o metadata devices (dm raid) - small code simplification (dm, dm-mpath, vm-vdo, dm-raid) - remove support for asynchronous hashes (dm-verity) - close smatch warning (dm-zoned-target) - update the documentation and enable inline-crypto passthrough (dm-thin) * tag 'for-6.17/dm-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm: set DM_TARGET_PASSES_CRYPTO feature for dm-thin dm-thin: update the documentation dm-raid: do not include dm-core.h vdo: omit need_resched() before cond_resched() md: dm-zoned-target: Initialize return variable r to avoid uninitialized use dm-verity: remove support for asynchronous hashes dm-mpath: don't print the "loaded" message if registering fails dm-mpath: make dm_unregister_path_selector return void dm: ima: avoid extra calls to strlen() dm: Simplify dm_io_complete() dm: Remove unnecessary return in dm_zone_endio() dm raid: add support for resync w/o metadata devices dm-flakey: Fix corrupt_bio_byte setup checks dm-table: fix checking for rq stackable devices
2 parents 69917db + 55a0fbd commit d632ab8

20 files changed

+110
-261
lines changed

Documentation/admin-guide/device-mapper/thin-provisioning.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ less sharing than average you'll need a larger-than-average metadata device.
8080

8181
As a guide, we suggest you calculate the number of bytes to use in the
8282
metadata device as 48 * $data_dev_size / $data_block_size but round it up
83-
to 2MB if the answer is smaller. If you're creating large numbers of
83+
to 2MiB if the answer is smaller. If you're creating large numbers of
8484
snapshots which are recording large amounts of change, you may find you
8585
need to increase this.
8686

87-
The largest size supported is 16GB: If the device is larger,
87+
The largest size supported is 16GiB: If the device is larger,
8888
a warning will be issued and the excess space will not be used.
8989

9090
Reloading a pool table
@@ -107,13 +107,13 @@ Using an existing pool device
107107

108108
$data_block_size gives the smallest unit of disk space that can be
109109
allocated at a time expressed in units of 512-byte sectors.
110-
$data_block_size must be between 128 (64KB) and 2097152 (1GB) and a
111-
multiple of 128 (64KB). $data_block_size cannot be changed after the
110+
$data_block_size must be between 128 (64KiB) and 2097152 (1GiB) and a
111+
multiple of 128 (64KiB). $data_block_size cannot be changed after the
112112
thin-pool is created. People primarily interested in thin provisioning
113-
may want to use a value such as 1024 (512KB). People doing lots of
114-
snapshotting may want a smaller value such as 128 (64KB). If you are
113+
may want to use a value such as 1024 (512KiB). People doing lots of
114+
snapshotting may want a smaller value such as 128 (64KiB). If you are
115115
not zeroing newly-allocated data, a larger $data_block_size in the
116-
region of 256000 (128MB) is suggested.
116+
region of 262144 (128MiB) is suggested.
117117

118118
$low_water_mark is expressed in blocks of size $data_block_size. If
119119
free space on the data device drops below this level then a dm event
@@ -291,7 +291,7 @@ i) Constructor
291291
error_if_no_space:
292292
Error IOs, instead of queueing, if no space.
293293

294-
Data block size must be between 64KB (128 sectors) and 1GB
294+
Data block size must be between 64KiB (128 sectors) and 1GiB
295295
(2097152 sectors) inclusive.
296296

297297

drivers/md/dm-flakey.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,19 @@ static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
215215
}
216216

217217
if (test_bit(DROP_WRITES, &fc->flags) &&
218-
(fc->corrupt_bio_rw == WRITE || fc->random_write_corrupt)) {
218+
((fc->corrupt_bio_byte && fc->corrupt_bio_rw == WRITE) ||
219+
fc->random_write_corrupt)) {
219220
ti->error = "drop_writes is incompatible with random_write_corrupt or corrupt_bio_byte with the WRITE flag set";
220221
return -EINVAL;
221222

222223
} else if (test_bit(ERROR_WRITES, &fc->flags) &&
223-
(fc->corrupt_bio_rw == WRITE || fc->random_write_corrupt)) {
224+
((fc->corrupt_bio_byte && fc->corrupt_bio_rw == WRITE) ||
225+
fc->random_write_corrupt)) {
224226
ti->error = "error_writes is incompatible with random_write_corrupt or corrupt_bio_byte with the WRITE flag set";
225227
return -EINVAL;
226228
} else if (test_bit(ERROR_READS, &fc->flags) &&
227-
(fc->corrupt_bio_rw == READ || fc->random_read_corrupt)) {
229+
((fc->corrupt_bio_byte && fc->corrupt_bio_rw == READ) ||
230+
fc->random_read_corrupt)) {
228231
ti->error = "error_reads is incompatible with random_read_corrupt or corrupt_bio_byte with the READ flag set";
229232
return -EINVAL;
230233
}

drivers/md/dm-ima.c

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,11 @@ void dm_ima_measure_on_table_load(struct dm_table *table, unsigned int status_fl
241241
/*
242242
* First retrieve the target metadata.
243243
*/
244-
scnprintf(target_metadata_buf, DM_IMA_TARGET_METADATA_BUF_LEN,
245-
"target_index=%d,target_begin=%llu,target_len=%llu,",
246-
i, ti->begin, ti->len);
247-
target_metadata_buf_len = strlen(target_metadata_buf);
244+
target_metadata_buf_len =
245+
scnprintf(target_metadata_buf,
246+
DM_IMA_TARGET_METADATA_BUF_LEN,
247+
"target_index=%d,target_begin=%llu,target_len=%llu,",
248+
i, ti->begin, ti->len);
248249

249250
/*
250251
* Then retrieve the actual target data.
@@ -448,11 +449,9 @@ void dm_ima_measure_on_device_resume(struct mapped_device *md, bool swap)
448449
if (r)
449450
goto error;
450451

451-
scnprintf(device_table_data, DM_IMA_DEVICE_BUF_LEN,
452-
"%sname=%s,uuid=%s;device_resume=no_data;",
453-
DM_IMA_VERSION_STR, dev_name, dev_uuid);
454-
l = strlen(device_table_data);
455-
452+
l = scnprintf(device_table_data, DM_IMA_DEVICE_BUF_LEN,
453+
"%sname=%s,uuid=%s;device_resume=no_data;",
454+
DM_IMA_VERSION_STR, dev_name, dev_uuid);
456455
}
457456

458457
capacity_len = strlen(capacity_str);
@@ -561,10 +560,9 @@ void dm_ima_measure_on_device_remove(struct mapped_device *md, bool remove_all)
561560
if (dm_ima_alloc_and_copy_name_uuid(md, &dev_name, &dev_uuid, noio))
562561
goto error;
563562

564-
scnprintf(device_table_data, DM_IMA_DEVICE_BUF_LEN,
565-
"%sname=%s,uuid=%s;device_remove=no_data;",
566-
DM_IMA_VERSION_STR, dev_name, dev_uuid);
567-
l = strlen(device_table_data);
563+
l = scnprintf(device_table_data, DM_IMA_DEVICE_BUF_LEN,
564+
"%sname=%s,uuid=%s;device_remove=no_data;",
565+
DM_IMA_VERSION_STR, dev_name, dev_uuid);
568566
}
569567

570568
memcpy(device_table_data + l, remove_all_str, remove_all_len);
@@ -647,10 +645,9 @@ void dm_ima_measure_on_table_clear(struct mapped_device *md, bool new_map)
647645
if (dm_ima_alloc_and_copy_name_uuid(md, &dev_name, &dev_uuid, noio))
648646
goto error2;
649647

650-
scnprintf(device_table_data, DM_IMA_DEVICE_BUF_LEN,
651-
"%sname=%s,uuid=%s;table_clear=no_data;",
652-
DM_IMA_VERSION_STR, dev_name, dev_uuid);
653-
l = strlen(device_table_data);
648+
l = scnprintf(device_table_data, DM_IMA_DEVICE_BUF_LEN,
649+
"%sname=%s,uuid=%s;table_clear=no_data;",
650+
DM_IMA_VERSION_STR, dev_name, dev_uuid);
654651
}
655652

656653
capacity_len = strlen(capacity_str);
@@ -706,7 +703,7 @@ void dm_ima_measure_on_device_rename(struct mapped_device *md)
706703
char *old_device_data = NULL, *new_device_data = NULL, *combined_device_data = NULL;
707704
char *new_dev_name = NULL, *new_dev_uuid = NULL, *capacity_str = NULL;
708705
bool noio = true;
709-
int r;
706+
int r, len;
710707

711708
if (dm_ima_alloc_and_copy_device_data(md, &new_device_data,
712709
md->ima.active_table.num_targets, noio))
@@ -728,12 +725,11 @@ void dm_ima_measure_on_device_rename(struct mapped_device *md)
728725
md->ima.active_table.device_metadata = new_device_data;
729726
md->ima.active_table.device_metadata_len = strlen(new_device_data);
730727

731-
scnprintf(combined_device_data, DM_IMA_DEVICE_BUF_LEN * 2,
732-
"%s%snew_name=%s,new_uuid=%s;%s", DM_IMA_VERSION_STR, old_device_data,
733-
new_dev_name, new_dev_uuid, capacity_str);
728+
len = scnprintf(combined_device_data, DM_IMA_DEVICE_BUF_LEN * 2,
729+
"%s%snew_name=%s,new_uuid=%s;%s", DM_IMA_VERSION_STR, old_device_data,
730+
new_dev_name, new_dev_uuid, capacity_str);
734731

735-
dm_ima_measure_data("dm_device_rename", combined_device_data, strlen(combined_device_data),
736-
noio);
732+
dm_ima_measure_data("dm_device_rename", combined_device_data, len, noio);
737733

738734
goto exit;
739735

drivers/md/dm-path-selector.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,24 +117,22 @@ int dm_register_path_selector(struct path_selector_type *pst)
117117
}
118118
EXPORT_SYMBOL_GPL(dm_register_path_selector);
119119

120-
int dm_unregister_path_selector(struct path_selector_type *pst)
120+
void dm_unregister_path_selector(struct path_selector_type *pst)
121121
{
122122
struct ps_internal *psi;
123123

124124
down_write(&_ps_lock);
125125

126126
psi = __find_path_selector_type(pst->name);
127-
if (!psi) {
127+
if (WARN_ON(!psi)) {
128128
up_write(&_ps_lock);
129-
return -EINVAL;
129+
return;
130130
}
131131

132132
list_del(&psi->list);
133133

134134
up_write(&_ps_lock);
135135

136136
kfree(psi);
137-
138-
return 0;
139137
}
140138
EXPORT_SYMBOL_GPL(dm_unregister_path_selector);

drivers/md/dm-path-selector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ struct path_selector_type {
9696
int dm_register_path_selector(struct path_selector_type *type);
9797

9898
/* Unregister a path selector */
99-
int dm_unregister_path_selector(struct path_selector_type *type);
99+
void dm_unregister_path_selector(struct path_selector_type *type);
100100

101101
/* Returns a registered path selector type */
102102
struct path_selector_type *dm_get_path_selector(const char *name);

drivers/md/dm-ps-historical-service-time.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,10 @@ static int __init dm_hst_init(void)
541541
{
542542
int r = dm_register_path_selector(&hst_ps);
543543

544-
if (r < 0)
544+
if (r < 0) {
545545
DMERR("register failed %d", r);
546+
return r;
547+
}
546548

547549
DMINFO("version " HST_VERSION " loaded");
548550

@@ -551,10 +553,7 @@ static int __init dm_hst_init(void)
551553

552554
static void __exit dm_hst_exit(void)
553555
{
554-
int r = dm_unregister_path_selector(&hst_ps);
555-
556-
if (r < 0)
557-
DMERR("unregister failed %d", r);
556+
dm_unregister_path_selector(&hst_ps);
558557
}
559558

560559
module_init(dm_hst_init);

drivers/md/dm-ps-io-affinity.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,7 @@ static int __init dm_ioa_init(void)
260260

261261
static void __exit dm_ioa_exit(void)
262262
{
263-
int ret = dm_unregister_path_selector(&ioa_ps);
264-
265-
if (ret < 0)
266-
DMERR("unregister failed %d", ret);
263+
dm_unregister_path_selector(&ioa_ps);
267264
}
268265

269266
module_init(dm_ioa_init);

drivers/md/dm-ps-queue-length.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,10 @@ static int __init dm_ql_init(void)
260260
{
261261
int r = dm_register_path_selector(&ql_ps);
262262

263-
if (r < 0)
263+
if (r < 0) {
264264
DMERR("register failed %d", r);
265+
return r;
266+
}
265267

266268
DMINFO("version " QL_VERSION " loaded");
267269

@@ -270,10 +272,7 @@ static int __init dm_ql_init(void)
270272

271273
static void __exit dm_ql_exit(void)
272274
{
273-
int r = dm_unregister_path_selector(&ql_ps);
274-
275-
if (r < 0)
276-
DMERR("unregister failed %d", r);
275+
dm_unregister_path_selector(&ql_ps);
277276
}
278277

279278
module_init(dm_ql_init);

drivers/md/dm-ps-round-robin.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,10 @@ static int __init dm_rr_init(void)
220220
{
221221
int r = dm_register_path_selector(&rr_ps);
222222

223-
if (r < 0)
223+
if (r < 0) {
224224
DMERR("register failed %d", r);
225+
return r;
226+
}
225227

226228
DMINFO("version " RR_VERSION " loaded");
227229

@@ -230,10 +232,7 @@ static int __init dm_rr_init(void)
230232

231233
static void __exit dm_rr_exit(void)
232234
{
233-
int r = dm_unregister_path_selector(&rr_ps);
234-
235-
if (r < 0)
236-
DMERR("unregister failed %d", r);
235+
dm_unregister_path_selector(&rr_ps);
237236
}
238237

239238
module_init(dm_rr_init);

drivers/md/dm-ps-service-time.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,10 @@ static int __init dm_st_init(void)
341341
{
342342
int r = dm_register_path_selector(&st_ps);
343343

344-
if (r < 0)
344+
if (r < 0) {
345345
DMERR("register failed %d", r);
346+
return r;
347+
}
346348

347349
DMINFO("version " ST_VERSION " loaded");
348350

@@ -351,10 +353,7 @@ static int __init dm_st_init(void)
351353

352354
static void __exit dm_st_exit(void)
353355
{
354-
int r = dm_unregister_path_selector(&st_ps);
355-
356-
if (r < 0)
357-
DMERR("unregister failed %d", r);
356+
dm_unregister_path_selector(&st_ps);
358357
}
359358

360359
module_init(dm_st_init);

0 commit comments

Comments
 (0)