]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.11-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Dec 2024 11:48:55 +0000 (12:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Dec 2024 11:48:55 +0000 (12:48 +0100)
added patches:
dm-bufio-fix-warnings-about-duplicate-slab-caches.patch

queue-6.11/dm-bufio-fix-warnings-about-duplicate-slab-caches.patch [new file with mode: 0644]
queue-6.11/series

diff --git a/queue-6.11/dm-bufio-fix-warnings-about-duplicate-slab-caches.patch b/queue-6.11/dm-bufio-fix-warnings-about-duplicate-slab-caches.patch
new file mode 100644 (file)
index 0000000..8199c4b
--- /dev/null
@@ -0,0 +1,61 @@
+From 42964e4b5e3ac95090bdd23ed7da2a941ccd902c Mon Sep 17 00:00:00 2001
+From: Mikulas Patocka <mpatocka@redhat.com>
+Date: Mon, 11 Nov 2024 16:48:18 +0100
+Subject: dm-bufio: fix warnings about duplicate slab caches
+
+From: Mikulas Patocka <mpatocka@redhat.com>
+
+commit 42964e4b5e3ac95090bdd23ed7da2a941ccd902c upstream.
+
+The commit 4c39529663b9 adds a warning about duplicate cache names if
+CONFIG_DEBUG_VM is selected. These warnings are triggered by the dm-bufio
+code. The dm-bufio code allocates a slab cache with each client. It is
+not possible to preallocate the caches in the module init function
+because the size of auxiliary per-buffer data is not known at this point.
+
+So, this commit changes dm-bufio so that it appends a unique atomic value
+to the cache name, to avoid the warnings.
+
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Fixes: 4c39529663b9 ("slab: Warn on duplicate cache names when DEBUG_VM=y")
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm-bufio.c |   12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+--- a/drivers/md/dm-bufio.c
++++ b/drivers/md/dm-bufio.c
+@@ -2474,7 +2474,8 @@ struct dm_bufio_client *dm_bufio_client_
+       int r;
+       unsigned int num_locks;
+       struct dm_bufio_client *c;
+-      char slab_name[27];
++      char slab_name[64];
++      static atomic_t seqno = ATOMIC_INIT(0);
+       if (!block_size || block_size & ((1 << SECTOR_SHIFT) - 1)) {
+               DMERR("%s: block size not specified or is not multiple of 512b", __func__);
+@@ -2525,7 +2526,8 @@ struct dm_bufio_client *dm_bufio_client_
+           (block_size < PAGE_SIZE || !is_power_of_2(block_size))) {
+               unsigned int align = min(1U << __ffs(block_size), (unsigned int)PAGE_SIZE);
+-              snprintf(slab_name, sizeof(slab_name), "dm_bufio_cache-%u", block_size);
++              snprintf(slab_name, sizeof(slab_name), "dm_bufio_cache-%u-%u",
++                                      block_size, atomic_inc_return(&seqno));
+               c->slab_cache = kmem_cache_create(slab_name, block_size, align,
+                                                 SLAB_RECLAIM_ACCOUNT, NULL);
+               if (!c->slab_cache) {
+@@ -2534,9 +2536,11 @@ struct dm_bufio_client *dm_bufio_client_
+               }
+       }
+       if (aux_size)
+-              snprintf(slab_name, sizeof(slab_name), "dm_bufio_buffer-%u", aux_size);
++              snprintf(slab_name, sizeof(slab_name), "dm_bufio_buffer-%u-%u",
++                                      aux_size, atomic_inc_return(&seqno));
+       else
+-              snprintf(slab_name, sizeof(slab_name), "dm_bufio_buffer");
++              snprintf(slab_name, sizeof(slab_name), "dm_bufio_buffer-%u",
++                                      atomic_inc_return(&seqno));
+       c->slab_buffer = kmem_cache_create(slab_name, sizeof(struct dm_buffer) + aux_size,
+                                          0, SLAB_RECLAIM_ACCOUNT, NULL);
+       if (!c->slab_buffer) {
index 2500e1a1a274b0eaae054aa80ddceeffb483cad4..ec10c451a1b2a0dd7048e2db0db1fd53a0965a48 100644 (file)
@@ -632,3 +632,4 @@ alsa-usb-audio-fix-out-of-bounds-reads-when-finding-clock-sources.patch
 usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch
 usb-typec-ucsi-glink-fix-off-by-one-in-connector_status.patch
 dm-cache-fix-warnings-about-duplicate-slab-caches.patch
+dm-bufio-fix-warnings-about-duplicate-slab-caches.patch