Skip to content

Commit 670c12c

Browse files
committed
Merge tag 'for-6.11/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mikulas Patocka: - fix misbehavior if suspend or resume is interrupted by a signal - fix wrong indentation in dm-crypt.rst - fix memory allocation failure in dm-persistent-data * tag 'for-6.11/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm persistent data: fix memory allocation failure Documentation: dm-crypt.rst warning + error fix dm resume: don't return EINVAL when signalled dm suspend: return -ERESTARTSYS instead of -EINTR
2 parents de53959 + faada21 commit 670c12c

File tree

4 files changed

+32
-13
lines changed

4 files changed

+32
-13
lines changed

Documentation/admin-guide/device-mapper/dm-crypt.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,14 @@ iv_large_sectors
162162

163163

164164
Module parameters::
165-
max_read_size
166-
max_write_size
167-
Maximum size of read or write requests. When a request larger than this size
168-
is received, dm-crypt will split the request. The splitting improves
169-
concurrency (the split requests could be encrypted in parallel by multiple
170-
cores), but it also causes overhead. The user should tune these parameters to
171-
fit the actual workload.
165+
166+
max_read_size
167+
max_write_size
168+
Maximum size of read or write requests. When a request larger than this size
169+
is received, dm-crypt will split the request. The splitting improves
170+
concurrency (the split requests could be encrypted in parallel by multiple
171+
cores), but it also causes overhead. The user should tune these parameters to
172+
fit the actual workload.
172173

173174

174175
Example scripts

drivers/md/dm-ioctl.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,8 +1181,26 @@ static int do_resume(struct dm_ioctl *param)
11811181
suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
11821182
if (param->flags & DM_NOFLUSH_FLAG)
11831183
suspend_flags |= DM_SUSPEND_NOFLUSH_FLAG;
1184-
if (!dm_suspended_md(md))
1185-
dm_suspend(md, suspend_flags);
1184+
if (!dm_suspended_md(md)) {
1185+
r = dm_suspend(md, suspend_flags);
1186+
if (r) {
1187+
down_write(&_hash_lock);
1188+
hc = dm_get_mdptr(md);
1189+
if (hc && !hc->new_map) {
1190+
hc->new_map = new_map;
1191+
new_map = NULL;
1192+
} else {
1193+
r = -ENXIO;
1194+
}
1195+
up_write(&_hash_lock);
1196+
if (new_map) {
1197+
dm_sync_table(md);
1198+
dm_table_destroy(new_map);
1199+
}
1200+
dm_put(md);
1201+
return r;
1202+
}
1203+
}
11861204

11871205
old_size = dm_get_size(md);
11881206
old_map = dm_swap_table(md, new_map);

drivers/md/dm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2737,7 +2737,7 @@ static int dm_wait_for_bios_completion(struct mapped_device *md, unsigned int ta
27372737
break;
27382738

27392739
if (signal_pending_state(task_state, current)) {
2740-
r = -EINTR;
2740+
r = -ERESTARTSYS;
27412741
break;
27422742
}
27432743

@@ -2762,7 +2762,7 @@ static int dm_wait_for_completion(struct mapped_device *md, unsigned int task_st
27622762
break;
27632763

27642764
if (signal_pending_state(task_state, current)) {
2765-
r = -EINTR;
2765+
r = -ERESTARTSYS;
27662766
break;
27672767
}
27682768

drivers/md/persistent-data/dm-space-map-metadata.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ static void sm_metadata_destroy(struct dm_space_map *sm)
277277
{
278278
struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm);
279279

280-
kfree(smm);
280+
kvfree(smm);
281281
}
282282

283283
static int sm_metadata_get_nr_blocks(struct dm_space_map *sm, dm_block_t *count)
@@ -772,7 +772,7 @@ struct dm_space_map *dm_sm_metadata_init(void)
772772
{
773773
struct sm_metadata *smm;
774774

775-
smm = kmalloc(sizeof(*smm), GFP_KERNEL);
775+
smm = kvmalloc(sizeof(*smm), GFP_KERNEL);
776776
if (!smm)
777777
return ERR_PTR(-ENOMEM);
778778

0 commit comments

Comments
 (0)