Skip to content

Commit

Permalink
Merge tag 'for-6.15/dm-fixes' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/device-mapper/linux-dm

Pull device mapper fixes from Mikulas Patocka:

 - always update the array size in realloc_argv on success

 - dm-integrity: fix a warning on invalid table line

 - dm-bufio: don't schedule in atomic context

 - Fix W=1 build with clang

* tag 'for-6.15/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
  dm: always update the array size in realloc_argv on success
  dm-integrity: fix a warning on invalid table line
  dm-bufio: don't schedule in atomic context
  dm table: Fix W=1 build warning when mempool_needs_integrity is unused
  • Loading branch information
Linus Torvalds committed Apr 28, 2025
2 parents f15d97d + 5a2a6c4 commit 78109c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
9 changes: 8 additions & 1 deletion drivers/md/dm-bufio.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
#define LIST_DIRTY 1
#define LIST_SIZE 2

#define SCAN_RESCHED_CYCLE 16

/*--------------------------------------------------------------*/

/*
Expand Down Expand Up @@ -2424,7 +2426,12 @@ static void __scan(struct dm_bufio_client *c)

atomic_long_dec(&c->need_shrink);
freed++;
cond_resched();

if (unlikely(freed % SCAN_RESCHED_CYCLE == 0)) {
dm_bufio_unlock(c);
cond_resched();
dm_bufio_lock(c);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -5164,7 +5164,7 @@ static void dm_integrity_dtr(struct dm_target *ti)
BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress));
BUG_ON(!list_empty(&ic->wait_list));

if (ic->mode == 'B')
if (ic->mode == 'B' && ic->bitmap_flush_work.work.func)
cancel_delayed_work_sync(&ic->bitmap_flush_work);
if (ic->metadata_wq)
destroy_workqueue(ic->metadata_wq);
Expand Down
8 changes: 3 additions & 5 deletions drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,10 @@ static char **realloc_argv(unsigned int *size, char **old_argv)
gfp = GFP_NOIO;
}
argv = kmalloc_array(new_size, sizeof(*argv), gfp);
if (argv && old_argv) {
memcpy(argv, old_argv, *size * sizeof(*argv));
if (argv) {
*size = new_size;
if (old_argv)
memcpy(argv, old_argv, *size * sizeof(*argv));
}

kfree(old_argv);
Expand Down Expand Up @@ -1049,7 +1050,6 @@ static int dm_table_alloc_md_mempools(struct dm_table *t, struct mapped_device *
unsigned int min_pool_size = 0, pool_size;
struct dm_md_mempools *pools;
unsigned int bioset_flags = 0;
bool mempool_needs_integrity = t->integrity_supported;

if (unlikely(type == DM_TYPE_NONE)) {
DMERR("no table type is set, can't allocate mempools");
Expand All @@ -1074,8 +1074,6 @@ static int dm_table_alloc_md_mempools(struct dm_table *t, struct mapped_device *

per_io_data_size = max(per_io_data_size, ti->per_io_data_size);
min_pool_size = max(min_pool_size, ti->num_flush_bios);

mempool_needs_integrity |= ti->mempool_needs_integrity;
}
pool_size = max(dm_get_reserved_bio_based_ios(), min_pool_size);
front_pad = roundup(per_io_data_size,
Expand Down

0 comments on commit 78109c5

Please sign in to comment.