<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/md/md-bitmap.c, branch v6.18.21</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.21</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.21'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-03-04T12:21:16+00:00</updated>
<entry>
<title>md/bitmap: fix GPF in write_page caused by resize race</title>
<updated>2026-03-04T12:21:16+00:00</updated>
<author>
<name>Jack Wang</name>
<email>jinpu.wang@ionos.com</email>
</author>
<published>2026-01-20T10:24:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9a6f8cd28bb9bb6ed86a6df19331fb08016dee7f'/>
<id>urn:sha1:9a6f8cd28bb9bb6ed86a6df19331fb08016dee7f</id>
<content type='text'>
[ Upstream commit 46ef85f854dfa9d5226b3c1c46493d79556c9589 ]

A General Protection Fault occurs in write_page() during array resize:
RIP: 0010:write_page+0x22b/0x3c0 [md_mod]

This is a use-after-free race between bitmap_daemon_work() and
__bitmap_resize(). The daemon iterates over `bitmap-&gt;storage.filemap`
without locking, while the resize path frees that storage via
md_bitmap_file_unmap(). `quiesce()` does not stop the md thread,
allowing concurrent access to freed pages.

Fix by holding `mddev-&gt;bitmap_info.mutex` during the bitmap update.

Link: https://lore.kernel.org/linux-raid/20260120102456.25169-1-jinpu.wang@ionos.com
Closes: https://lore.kernel.org/linux-raid/CAMGffE=Mbfp=7xD_hYxXk1PAaCZNSEAVeQGKGy7YF9f2S4=NEA@mail.gmail.com/T/#u
Cc: stable@vger.kernel.org
Fixes: d60b479d177a ("md/bitmap: add bitmap_resize function to allow bitmap resizing.")
Signed-off-by: Jack Wang &lt;jinpu.wang@ionos.com&gt;
Signed-off-by: Yu Kuai &lt;yukuai@fnnas.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>md/md-llbitmap: introduce new lockless bitmap</title>
<updated>2025-09-06T09:27:51+00:00</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2025-08-29T08:04:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5ab829f1971dc99f2aac10846c378e67fc875abc'/>
<id>urn:sha1:5ab829f1971dc99f2aac10846c378e67fc875abc</id>
<content type='text'>
Redundant data is used to enhance data fault tolerance, and the storage
method for redundant data vary depending on the RAID levels. And it's
important to maintain the consistency of redundant data.

Bitmap is used to record which data blocks have been synchronized and which
ones need to be resynchronized or recovered. Each bit in the bitmap
represents a segment of data in the array. When a bit is set, it indicates
that the multiple redundant copies of that data segment may not be
consistent. Data synchronization can be performed based on the bitmap after
power failure or readding a disk. If there is no bitmap, a full disk
synchronization is required.

Due to known performance issues with md-bitmap and the unreasonable
implementations:

 - self-managed IO submitting like filemap_write_page();
 - global spin_lock

I have decided not to continue optimizing based on the current bitmap
implementation, this new bitmap is invented without locking from IO fast
path and can be used with fast disks.

For designs and details, see the comments in drivers/md-llbitmap.c.

Link: https://lore.kernel.org/linux-raid/20250829080426.1441678-12-yukuai1@huaweicloud.com
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Reviewed-by: Li Nan &lt;linan122@huawei.com&gt;
</content>
</entry>
<entry>
<title>md/md-bitmap: support discard for bitmap ops</title>
<updated>2025-09-06T09:18:19+00:00</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2025-08-29T08:04:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ac9dad8faaa7b2a7c7c6de0017f2d7d54525d33c'/>
<id>urn:sha1:ac9dad8faaa7b2a7c7c6de0017f2d7d54525d33c</id>
<content type='text'>
Use two new methods {start, end}_discard in bitmap_ops and a new field 'rw'
in struct md_io_clone to handle discard IO, prepare to support new md
bitmap.

Since all bitmap functions to hanlde write IO are the same, also add
typedef to make code cleaner.

Link: https://lore.kernel.org/linux-raid/20250829080426.1441678-4-yukuai1@huaweicloud.com
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Reviewed-by: Xiao Ni &lt;xni@redhat.com&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Reviewed-by: Li Nan &lt;linan122@huawei.com&gt;
</content>
</entry>
<entry>
<title>md: add a new parameter 'offset' to md_super_write()</title>
<updated>2025-09-06T09:17:26+00:00</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2025-08-29T08:04:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d01acbce391767318c94fb1f6d648cfabb428f9d'/>
<id>urn:sha1:d01acbce391767318c94fb1f6d648cfabb428f9d</id>
<content type='text'>
The parameter is always set to 0 for now, following patches will use
this helper to write llbitmap to underlying disks, allow writing
dirty sectors instead of the whole page.

Also rename md_super_write to md_write_metadata since there is nothing
super-block specific.

Link: https://lore.kernel.org/linux-raid/20250829080426.1441678-2-yukuai1@huaweicloud.com
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Reviewed-by: Xiao Ni &lt;xni@redhat.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Reviewed-by: Li Nan &lt;linan122@huawei.com&gt;
</content>
</entry>
<entry>
<title>md/md-bitmap: introduce CONFIG_MD_BITMAP</title>
<updated>2025-09-06T09:12:22+00:00</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2025-07-07T01:27:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c27474ac1d4609af3c1c38ccac252c2575b47b9e'/>
<id>urn:sha1:c27474ac1d4609af3c1c38ccac252c2575b47b9e</id>
<content type='text'>
Now that all implementations are internal, it's sensible to add a config
option for md-bitmap, and it's a good way for isolation.

Link: https://lore.kernel.org/linux-raid/20250707012711.376844-16-yukuai1@huaweicloud.com
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Reviewed-by: Xiao Ni &lt;xni@redhat.com&gt;
</content>
</entry>
<entry>
<title>md/raid1: check bitmap before behind write</title>
<updated>2025-09-06T09:11:58+00:00</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2025-07-07T01:27:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=20cecae877a634ffc49b4cd7b0f6927209badbab'/>
<id>urn:sha1:20cecae877a634ffc49b4cd7b0f6927209badbab</id>
<content type='text'>
behind write rely on bitmap, because the number of IO are recorded in
bitmap-&gt;behind_writes, and callers rely on bitmap_wait_behind_writes()
to wait for IO to be done.

However, currently callers doesn't check if bitmap is enabeld before
calling into behind methods. Hence if behind write start without bitmap,
readers will not wait for slow write IO to be done and old data can be
read in some corner cases.

Link: https://lore.kernel.org/linux-raid/20250707012711.376844-10-yukuai1@huaweicloud.com
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Reviewed-by: Xiao Ni &lt;xni@redhat.com&gt;
</content>
</entry>
<entry>
<title>md/md-bitmap: handle the case bitmap is not enabled before end_sync()</title>
<updated>2025-09-06T09:11:54+00:00</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2025-07-07T01:27:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bb74b093c33cf20876e23ad8aa0d206b537ccb69'/>
<id>urn:sha1:bb74b093c33cf20876e23ad8aa0d206b537ccb69</id>
<content type='text'>
This case can be handled without knowing internal implementation.

Prepare to introduce CONFIG_MD_BITMAP.

Link: https://lore.kernel.org/linux-raid/20250707012711.376844-9-yukuai1@huaweicloud.com
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Reviewed-by: Xiao Ni &lt;xni@redhat.com&gt;
</content>
</entry>
<entry>
<title>md/md-bitmap: handle the case bitmap is not enabled before start_sync()</title>
<updated>2025-09-06T09:11:50+00:00</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2025-07-07T01:27:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5ae58d1500e3fc16df3267fad810955c949afdb2'/>
<id>urn:sha1:5ae58d1500e3fc16df3267fad810955c949afdb2</id>
<content type='text'>
This case can be handled without knowing internal implementation.

Prepare to introduce CONFIG_MD_BITMAP.

Link: https://lore.kernel.org/linux-raid/20250707012711.376844-8-yukuai1@huaweicloud.com
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Reviewed-by: Xiao Ni &lt;xni@redhat.com&gt;
</content>
</entry>
<entry>
<title>md/md-bitmap: add md_bitmap_registered/enabled() helper</title>
<updated>2025-09-06T09:11:45+00:00</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2025-07-07T01:27:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=110332074dc6ad2f07a3cf9cc45b03adbce0e54f'/>
<id>urn:sha1:110332074dc6ad2f07a3cf9cc45b03adbce0e54f</id>
<content type='text'>
There are no functional changes, prepare to handle the case that
mddev-&gt;bitmap_ops can be NULL, which is possible after introducing
CONFIG_MD_BITMAP.

Link: https://lore.kernel.org/linux-raid/20250707012711.376844-7-yukuai1@huaweicloud.com
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Reviewed-by: Xiao Ni &lt;xni@redhat.com&gt;
</content>
</entry>
<entry>
<title>md/md-bitmap: add a new parameter 'flush' to bitmap_ops-&gt;enabled</title>
<updated>2025-09-06T09:11:42+00:00</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2025-07-07T01:27:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9c41ead04ec0d3ee54505039879aee20cf495e0a'/>
<id>urn:sha1:9c41ead04ec0d3ee54505039879aee20cf495e0a</id>
<content type='text'>
The method is only used from raid1/raid10 IO path, to check if write
bio should be pluged, the parameter is always set to true for now,
following patch will use this helper in other context like updating
superblock.

Link: https://lore.kernel.org/linux-raid/20250707012711.376844-6-yukuai1@huaweicloud.com
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Reviewed-by: Xiao Ni &lt;xni@redhat.com&gt;
</content>
</entry>
</feed>
