<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/drivers/md/md-bitmap.c, branch linux-6.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.9.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.9.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2024-05-30T07:44:10Z</updated>
<entry>
<title>md: fix resync softlockup when bitmap size is less than array size</title>
<updated>2024-05-30T07:44:10Z</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2024-04-22T06:58:24Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=8bbc71315e0ae4bb7e37f8d43b915e1cb01a481b'/>
<id>urn:sha1:8bbc71315e0ae4bb7e37f8d43b915e1cb01a481b</id>
<content type='text'>
[ Upstream commit f0e729af2eb6bee9eb58c4df1087f14ebaefe26b ]

Is is reported that for dm-raid10, lvextend + lvchange --syncaction will
trigger following softlockup:

kernel:watchdog: BUG: soft lockup - CPU#3 stuck for 26s! [mdX_resync:6976]
CPU: 7 PID: 3588 Comm: mdX_resync Kdump: loaded Not tainted 6.9.0-rc4-next-20240419 #1
RIP: 0010:_raw_spin_unlock_irq+0x13/0x30
Call Trace:
 &lt;TASK&gt;
 md_bitmap_start_sync+0x6b/0xf0
 raid10_sync_request+0x25c/0x1b40 [raid10]
 md_do_sync+0x64b/0x1020
 md_thread+0xa7/0x170
 kthread+0xcf/0x100
 ret_from_fork+0x30/0x50
 ret_from_fork_asm+0x1a/0x30

And the detailed process is as follows:

md_do_sync
 j = mddev-&gt;resync_min
 while (j &lt; max_sectors)
  sectors = raid10_sync_request(mddev, j, &amp;skipped)
   if (!md_bitmap_start_sync(..., &amp;sync_blocks))
    // md_bitmap_start_sync set sync_blocks to 0
    return sync_blocks + sectors_skippe;
  // sectors = 0;
  j += sectors;
  // j never change

Root cause is that commit 301867b1c168 ("md/raid10: check
slab-out-of-bounds in md_bitmap_get_counter") return early from
md_bitmap_get_counter(), without setting returned blocks.

Fix this problem by always set returned blocks from
md_bitmap_get_counter"(), as it used to be.

Noted that this patch just fix the softlockup problem in kernel, the
case that bitmap size doesn't match array size still need to be fixed.

Fixes: 301867b1c168 ("md/raid10: check slab-out-of-bounds in md_bitmap_get_counter")
Reported-and-tested-by: Nigel Croxon &lt;ncroxon@redhat.com&gt;
Closes: https://lore.kernel.org/all/71ba5272-ab07-43ba-8232-d2da642acb4e@redhat.com/
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Link: https://lore.kernel.org/r/20240422065824.2516-1-yukuai1@huaweicloud.com
Signed-off-by: Song Liu &lt;song@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>md: add a mddev_add_trace_msg helper</title>
<updated>2024-03-06T16:59:52Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2024-03-03T14:01:41Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=28be4fd310d146e9a43d7b1bb55cb7e9f5e06e88'/>
<id>urn:sha1:28be4fd310d146e9a43d7b1bb55cb7e9f5e06e88</id>
<content type='text'>
Add a small wrapper around blk_add_trace_msg that hides some argument
dereferences and the check for a DM-mapped MD device.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed--by: Song Liu &lt;song@kernel.org&gt;
Tested-by: Song Liu &lt;song@kernel.org&gt;
Signed-off-by: Song Liu &lt;song@kernel.org&gt;
Link: https://lore.kernel.org/r/20240303140150.5435-3-hch@lst.de
</content>
</entry>
<entry>
<title>md/md-bitmap: fix incorrect usage for sb_index</title>
<updated>2024-02-26T21:34:44Z</updated>
<author>
<name>Heming Zhao</name>
<email>heming.zhao@suse.com</email>
</author>
<published>2024-02-23T12:11:28Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ecbd8ebb51bf7e4939d83b9e6022a55cac44ef06'/>
<id>urn:sha1:ecbd8ebb51bf7e4939d83b9e6022a55cac44ef06</id>
<content type='text'>
Commit d7038f951828 ("md-bitmap: don't use -&gt;index for pages backing the
bitmap file") removed page-&gt;index from bitmap code, but left wrong code
logic for clustered-md. current code never set slot offset for cluster
nodes, will sometimes cause crash in clustered env.

Call trace (partly):
 md_bitmap_file_set_bit+0x110/0x1d8 [md_mod]
 md_bitmap_startwrite+0x13c/0x240 [md_mod]
 raid1_make_request+0x6b0/0x1c08 [raid1]
 md_handle_request+0x1dc/0x368 [md_mod]
 md_submit_bio+0x80/0xf8 [md_mod]
 __submit_bio+0x178/0x300
 submit_bio_noacct_nocheck+0x11c/0x338
 submit_bio_noacct+0x134/0x614
 submit_bio+0x28/0xdc
 submit_bh_wbc+0x130/0x1cc
 submit_bh+0x1c/0x28

Fixes: d7038f951828 ("md-bitmap: don't use -&gt;index for pages backing the bitmap file")
Cc: stable@vger.kernel.org # v6.6+
Signed-off-by: Heming Zhao &lt;heming.zhao@suse.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Song Liu &lt;song@kernel.org&gt;
Link: https://lore.kernel.org/r/20240223121128.28985-1-heming.zhao@suse.com
</content>
</entry>
<entry>
<title>md: cleanup mddev_create/destroy_serial_pool()</title>
<updated>2023-10-11T01:49:51Z</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2023-10-10T15:19:53Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b4128c00a653dfd08fbe3d26fcf4c8b4970a69ba'/>
<id>urn:sha1:b4128c00a653dfd08fbe3d26fcf4c8b4970a69ba</id>
<content type='text'>
Now that except for stopping the array, all the callers already suspend
the array, there is no need to suspend anymore, hence remove the second
parameter.

Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Signed-off-by: Song Liu &lt;song@kernel.org&gt;
Link: https://lore.kernel.org/r/20231010151958.145896-15-yukuai1@huaweicloud.com
</content>
</entry>
<entry>
<title>md: use new apis to suspend array before mddev_create/destroy_serial_pool</title>
<updated>2023-10-11T01:49:50Z</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2023-10-10T15:19:52Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=58226942ad3d1423785f815ede5bcc832574f2ea'/>
<id>urn:sha1:58226942ad3d1423785f815ede5bcc832574f2ea</id>
<content type='text'>
mddev_create/destroy_serial_pool() will be called from several places
where mddev_suspend() will be called later.

Prepare to remove the mddev_suspend() from
mddev_create/destroy_serial_pool().

Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Signed-off-by: Song Liu &lt;song@kernel.org&gt;
Link: https://lore.kernel.org/r/20231010151958.145896-14-yukuai1@huaweicloud.com
</content>
</entry>
<entry>
<title>md/md-bitmap: use new apis to suspend array for location_store()</title>
<updated>2023-10-11T01:49:50Z</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2023-10-10T15:19:46Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3cddf86a57a58441eb019d21acea147f043dc13c'/>
<id>urn:sha1:3cddf86a57a58441eb019d21acea147f043dc13c</id>
<content type='text'>
Convert to use new apis, the old apis will be removed eventually.

This is not hot path, so performance is not concerned.

Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Signed-off-by: Song Liu &lt;song@kernel.org&gt;
Link: https://lore.kernel.org/r/20231010151958.145896-8-yukuai1@huaweicloud.com
</content>
</entry>
<entry>
<title>md-bitmap: suspend array earlier in location_store()</title>
<updated>2023-09-22T17:28:27Z</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2023-08-25T03:09:54Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=158d32af8710777b146f5303a5ca066b493d18e8'/>
<id>urn:sha1:158d32af8710777b146f5303a5ca066b493d18e8</id>
<content type='text'>
Now that mddev_suspend() doean't rely on 'mddev-&gt;pers' to be set, it's
safe to call mddev_suspend() earlier.

This will also be helper to refactor mddev_suspend() later.

Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Signed-off-by: Song Liu &lt;song@kernel.org&gt;
Link: https://lore.kernel.org/r/20230825030956.1527023-6-yukuai1@huaweicloud.com
</content>
</entry>
<entry>
<title>md-bitmap: remove the checking of 'pers-&gt;quiesce' from location_store()</title>
<updated>2023-09-22T17:28:27Z</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2023-08-25T03:09:53Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b71fe4ac7531d67e6fc8c287cbcb2b176aa93833'/>
<id>urn:sha1:b71fe4ac7531d67e6fc8c287cbcb2b176aa93833</id>
<content type='text'>
After commit 4d27e927344a ("md: don't quiesce in mddev_suspend()"),
there is no need to check 'pers-&gt;quiesce' before calling
mddev_suspend().

Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Signed-off-by: Song Liu &lt;song@kernel.org&gt;
Link: https://lore.kernel.org/r/20230825030956.1527023-5-yukuai1@huaweicloud.com
</content>
</entry>
<entry>
<title>md/md-bitmap: hold 'reconfig_mutex' in backlog_store()</title>
<updated>2023-07-27T07:13:30Z</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2023-07-06T08:37:27Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=44abfa6a95df425c0660d56043020b67e6d93ab8'/>
<id>urn:sha1:44abfa6a95df425c0660d56043020b67e6d93ab8</id>
<content type='text'>
Several reasons why 'reconfig_mutex' should be held:

1) rdev_for_each() is not safe to be called without the lock, because
   rdev can be removed concurrently.
2) mddev_destroy_serial_pool() and mddev_create_serial_pool() should not
   be called concurrently.
3) mddev_suspend() from mddev_destroy/create_serial_pool() should be
   protected by the lock.

Fixes: 10c92fca636e ("md-bitmap: create and destroy wb_info_pool with the change of backlog")
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Link: https://lore.kernel.org/r/20230706083727.608914-3-yukuai1@huaweicloud.com
Signed-off-by: Song Liu &lt;song@kernel.org&gt;
</content>
</entry>
<entry>
<title>md/md-bitmap: remove unnecessary local variable in backlog_store()</title>
<updated>2023-07-27T07:13:30Z</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2023-07-06T08:37:26Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b4d129640f194ffc4cc64c3e97f98ae944c072e8'/>
<id>urn:sha1:b4d129640f194ffc4cc64c3e97f98ae944c072e8</id>
<content type='text'>
Local variable is definied first in the beginning of backlog_store(),
there is no need to define it again.

Fixes: 8c13ab115b57 ("md/bitmap: don't set max_write_behind if there is no write mostly device")
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Link: https://lore.kernel.org/r/20230706083727.608914-2-yukuai1@huaweicloud.com
Signed-off-by: Song Liu &lt;song@kernel.org&gt;
</content>
</entry>
</feed>
