<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/md/raid1.c, branch v7.2-rc1</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v7.2-rc1</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v7.2-rc1'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-06-20T20:44:42+00:00</updated>
<entry>
<title>md/raid1: protect head_position for read balance</title>
<updated>2026-06-20T20:44:42+00:00</updated>
<author>
<name>Chen Cheng</name>
<email>chencheng@fnnas.com</email>
</author>
<published>2026-06-19T04:41:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=601d3c21b2e26b676cc67ae8804e991bbbcd4507'/>
<id>urn:sha1:601d3c21b2e26b676cc67ae8804e991bbbcd4507</id>
<content type='text'>
KCSAN reports a data race between raid1_end_read_request() and
raid1_read_request().

The completion path updates conf-&gt;mirrors[disk].head_position in
update_head_pos() without a lock, while the read-balance heuristic reads
the same field locklessly in is_sequential() and choose_best_rdev().

KCSAN report:
=========================
  BUG: KCSAN: data-race in raid1_end_read_request / raid1_read_request

  write to 0xffff8f0306ba7868 of 8 bytes by interrupt on cpu 9:
    raid1_end_read_request+0xb5/0x440
    bio_endio+0x3c9/0x3e0
    blk_update_request+0x257/0x770
    scsi_end_request+0x4d/0x520
    scsi_io_completion+0x6f/0x990
    scsi_finish_command+0x188/0x280
    scsi_complete+0xac/0x160
    blk_complete_reqs+0x8e/0xb0
    blk_done_softirq+0x1d/0x30
   [...]

  read to 0xffff8f0306ba7868 of 8 bytes by task 667002 on cpu 11:
    raid1_read_request+0x497/0x1a10
    raid1_make_request+0xdf/0x1950
    md_handle_request+0x2c5/0x700
    md_submit_bio+0x126/0x320
    __submit_bio+0x2ec/0x3a0
    submit_bio_noacct_nocheck+0x572/0x890
   [...]

  value changed: 0x0000000000000078 -&gt; 0x00000000005fe448

Signed-off-by: Chen Cheng &lt;chencheng@fnnas.com&gt;
Link: https://patch.msgid.link/20260619044114.1208456-1-chencheng@fnnas.com
Signed-off-by: Yu Kuai &lt;yukuai@fygo.io&gt;
</content>
</entry>
<entry>
<title>md/raid1: free r1_bio when REQ_NOWAIT is set and read would block on retry</title>
<updated>2026-06-20T20:30:54+00:00</updated>
<author>
<name>Abd-Alrhman Masalkhi</name>
<email>abd.masalkhi@gmail.com</email>
</author>
<published>2026-06-11T10:13:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=69ad6ce47f9bf2b9fe0ed69b042db993d33bbf12'/>
<id>urn:sha1:69ad6ce47f9bf2b9fe0ed69b042db993d33bbf12</id>
<content type='text'>
When a read is retried, raid1_read_request() may be called with a
pre-allocated r1_bio. If wait_read_barrier() fails for a REQ_NOWAIT
read, the bio is completed and the function returns immediately. In this
case the existing r1_bio is leaked.

This fixes a leak of pre-allocated r1_bio structures for retried reads.

Fixes: 5aa705039c4f ("md: raid1 add nowait support")
Reported-by: sashiko-bot &lt;sashiko-bot@kernel.org&gt;
Closes: https://sashiko.dev/#/patchset/20260611083514.754922-1-abd.masalkhi@gmail.com?part=1
Signed-off-by: Abd-Alrhman Masalkhi &lt;abd.masalkhi@gmail.com&gt;
Link: https://patch.msgid.link/20260611101350.759154-1-abd.masalkhi@gmail.com
Signed-off-by: Yu Kuai &lt;yukuai@fygo.io&gt;
</content>
</entry>
<entry>
<title>md/raid1: honor REQ_NOWAIT when waiting for behind writes</title>
<updated>2026-06-20T20:19:27+00:00</updated>
<author>
<name>Abd-Alrhman Masalkhi</name>
<email>abd.masalkhi@gmail.com</email>
</author>
<published>2026-06-11T08:35:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a286cb88ddb26c5f4377859d8e77233d9181eb82'/>
<id>urn:sha1:a286cb88ddb26c5f4377859d8e77233d9181eb82</id>
<content type='text'>
raid1 supports REQ_NOWAIT reads by avoiding waits in the barrier path
through wait_read_barrier(). However, a read can still block on a
WriteMostly device when the array uses a bitmap and there are
outstanding behind writes.

In that case raid1 unconditionally calls wait_behind_writes(), which
may sleep until all behind writes complete. As a result, a REQ_NOWAIT
read can block despite the caller explicitly requesting non-blocking
behavior.

This ensures that raid1 consistently honors REQ_NOWAIT reads across all
paths that may otherwise wait for behind writes.

Fixes: 5aa705039c4f ("md: raid1 add nowait support")
Signed-off-by: Abd-Alrhman Masalkhi &lt;abd.masalkhi@gmail.com&gt;
Link: https://patch.msgid.link/20260611083514.754922-1-abd.masalkhi@gmail.com
Signed-off-by: Yu Kuai &lt;yukuai@fygo.io&gt;
</content>
</entry>
<entry>
<title>md/raid1: simplify raid1_write_request() error handling</title>
<updated>2026-06-20T18:14:44+00:00</updated>
<author>
<name>Abd-Alrhman Masalkhi</name>
<email>abd.masalkhi@gmail.com</email>
</author>
<published>2026-06-13T18:28:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a4c55c902670f2784d3001652183aafa17712cfe'/>
<id>urn:sha1:a4c55c902670f2784d3001652183aafa17712cfe</id>
<content type='text'>
raid1_write_request() increments rdev-&gt;nr_pending before checking the
badblocks and then immediately decrements it again when a device is
skipped. Move the increment until after the checks succeed so the
reference accounting is easier to follow.

Consolidate the failure paths so that each error label releases exactly
the resources acquired up to that point. err_dec_pending drops pending
references and frees the r1bio, while err_allow_barrier handles the
barrier release before returning.

When a REQ_ATOMIC write cannot be satisfied due to a badblock range,
complete the bio with BLK_STS_NOTSUPP rather than reporting an I/O
error, since the operation is unsupported rather than having failed
during I/O.

Rename max_write_sectors to max_sectors and remove the redundant local
copy.

Signed-off-by: Abd-Alrhman Masalkhi &lt;abd.masalkhi@gmail.com&gt;
Link: https://patch.msgid.link/20260613182810.1317258-5-abd.masalkhi@gmail.com
Signed-off-by: Yu Kuai &lt;yukuai@fygo.io&gt;
</content>
</entry>
<entry>
<title>md/raid1: fix writes_pending and barrier reference leaks on write failures</title>
<updated>2026-06-20T18:14:44+00:00</updated>
<author>
<name>Abd-Alrhman Masalkhi</name>
<email>abd.masalkhi@gmail.com</email>
</author>
<published>2026-06-13T18:28:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8e065a1602511282fc0da2dc89445e0eb71a681c'/>
<id>urn:sha1:8e065a1602511282fc0da2dc89445e0eb71a681c</id>
<content type='text'>
raid1_make_request() acquires a writes_pending reference with
md_write_start() before calling raid1_write_request(). Several failure
paths in raid1_write_request() complete the bio and return without
reaching the normal write completion path, causing the corresponding
md_write_end() to be skipped.

Make raid1_write_request() return a status indicating whether the write
request was successfully queued. This allows raid1_make_request() to
call md_write_end() when raid1_write_request() fails.

Additionally, if wait_blocked_rdev() fails after wait_barrier()
succeeds, the associated barrier reference is not released.

Call allow_barrier() before returning from that path to keep the barrier
accounting balanced.

Fixes: b1a7ad8b5c4f ("md/raid1: Handle bio_split() errors")
Fixes: f2a38abf5f1c ("md/raid1: Atomic write support")
Fixes: 5aa705039c4f ("md: raid1 add nowait support")
Reported-by: sashiko-bot &lt;sashiko-bot@kernel.org&gt;
Closes: https://sashiko.dev/#/patchset/20260611083514.754922-1-abd.masalkhi@gmail.com?part=1
Closes: https://sashiko.dev/#/patchset/20260611132500.763528-1-abd.masalkhi@gmail.com?part=1
Signed-off-by: Abd-Alrhman Masalkhi &lt;abd.masalkhi@gmail.com&gt;
Link: https://patch.msgid.link/20260613182810.1317258-2-abd.masalkhi@gmail.com
Signed-off-by: Yu Kuai &lt;yukuai@fygo.io&gt;
</content>
</entry>
<entry>
<title>Merge tag 'md-7.2-20260531' of https://git.kernel.org/pub/scm/linux/kernel/git/mdraid/linux into for-7.2/block</title>
<updated>2026-06-01T18:52:20+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2026-06-01T18:52:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b30288887c06772667b2b3133ac88d1b5bbcfa74'/>
<id>urn:sha1:b30288887c06772667b2b3133ac88d1b5bbcfa74</id>
<content type='text'>
Pull MD updates and fixes from Yu Kuai:

"Bug Fixes:
 - Only requeue dm-raid bios when dm is suspending. (Benjamin Marzinski)
 - Reset raid10 read_slot when reusing r10bio for discard. (Chen Cheng)
 - Fix raid1/raid10 deadlock in read error recovery path.
   (Abd-Alrhman Masalkhi)
 - Fix raid1/raid10 error-path detection with md_cloned_bio().
   (Abd-Alrhman Masalkhi)
 - Fix raid1/raid10 bio accounting for split md cloned bios.
   (Abd-Alrhman Masalkhi)
 - Fix raid1 nr_pending leak in REQ_ATOMIC bad-block path.
   (Abd-Alrhman Masalkhi)

 Improvements:
 - Skip redundant raid_disks updates when the value is unchanged.
   (Abd-Alrhman Masalkhi)

 Cleanups:
 - Update MAINTAINERS email addresses. (Yu Kuai, Li Nan)
 - Clean up raid1 read error handling. (Christoph Hellwig)
 - Move the exceed_read_errors condition out of fix_read_error().
   (Christoph Hellwig)
 - Use str_plural() in raid0 dump_zones(). (Thorsten Blum)"

* tag 'md-7.2-20260531' of https://git.kernel.org/pub/scm/linux/kernel/git/mdraid/linux:
  md/raid0: use str_plural helper in dump_zones
  raid1: fix nr_pending leak in REQ_ATOMIC bad-block error path
  md/raid1: move the exceed_read_errors condition out of fix_read_error
  md/raid1: cleanup handle_read_error
  md/raid1,raid10: fix bio accounting for split md cloned bios
  md/raid1,raid10: fix error-path detection with md_cloned_bio()
  md/raid1,raid10: fix deadlock in read error recovery path
  md/raid10: reset read_slot when reusing r10bio for discard
  md: skip redundant raid_disks update when value is unchanged
  dm-raid: only requeue bios when dm is suspending
  MAINTAINERS: Update Li Nan's E-mail address
  MAINTAINERS: update Yu Kuai's email address
</content>
</entry>
<entry>
<title>raid1: fix nr_pending leak in REQ_ATOMIC bad-block error path</title>
<updated>2026-05-31T11:09:19+00:00</updated>
<author>
<name>Abd-Alrhman Masalkhi</name>
<email>abd.masalkhi@gmail.com</email>
</author>
<published>2026-05-30T15:14:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=909d9dc3b5730c8ed7b764c68bc788342df2a07b'/>
<id>urn:sha1:909d9dc3b5730c8ed7b764c68bc788342df2a07b</id>
<content type='text'>
In raid1_write_request(), each per-mirror loop iteration begins by
incrementing rdev-&gt;nr_pending. If a REQ_ATOMIC write encounters a
badblock within the requested range, the code jumps to err_handle
without dropping the reference taken for the current mirror.

err_handle's cleanup loop will only decrements for k &lt; i and
r1_bio-&gt;bios[k] is non-NULL. The current slot is therefore skipped,
leaving its nr_pending reference leaked permanently. The reference
prevents the rdev from ever being removed, since raid1_remove_conf()
refuses to remove an rdev with nr_pending &gt; 0.

Fix this by calling rdev_dec_pending() before jumping to err_handle.

Fixes: f2a38abf5f1c ("md/raid1: Atomic write support")
Signed-off-by: Abd-Alrhman Masalkhi &lt;abd.masalkhi@gmail.com&gt;
Link: https://patch.msgid.link/20260530151411.4119-1-abd.masalkhi@gmail.com
Signed-off-by: Yu Kuai &lt;yukuai@fygo.io&gt;
</content>
</entry>
<entry>
<title>md/raid1: move the exceed_read_errors condition out of fix_read_error</title>
<updated>2026-05-31T11:09:19+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2026-05-29T05:43:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6e3b0b91334d1dfaa20ca55eac835f5945a3b7c8'/>
<id>urn:sha1:6e3b0b91334d1dfaa20ca55eac835f5945a3b7c8</id>
<content type='text'>
This condition much better fits into the only caller, limiting
fix_read_error to actually fix up data devices after a read error.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Link: https://patch.msgid.link/20260529054308.2720300-3-hch@lst.de
Signed-off-by: Yu Kuai &lt;yukuai@fygo.io&gt;
</content>
</entry>
<entry>
<title>md/raid1: cleanup handle_read_error</title>
<updated>2026-05-31T11:09:19+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2026-05-29T05:42:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fcba8031327ddac251671fdc1be5399786b8dda7'/>
<id>urn:sha1:fcba8031327ddac251671fdc1be5399786b8dda7</id>
<content type='text'>
Unwind the main conditional with duplicate conditions and initialize
variables at initialization time where possible.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Link: https://patch.msgid.link/20260529054308.2720300-2-hch@lst.de
Signed-off-by: Yu Kuai &lt;yukuai@fygo.io&gt;
</content>
</entry>
<entry>
<title>md/raid1,raid10: fix bio accounting for split md cloned bios</title>
<updated>2026-05-31T11:09:18+00:00</updated>
<author>
<name>Abd-Alrhman Masalkhi</name>
<email>abd.masalkhi@gmail.com</email>
</author>
<published>2026-05-01T11:46:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ba976e3501111d11c550848b3b7341a73035f582'/>
<id>urn:sha1:ba976e3501111d11c550848b3b7341a73035f582</id>
<content type='text'>
Use md_cloned_bio() to control bio accounting instead of relying
on r1bio_existed in raid1 or the io_accounting flag in raid10.

The previous logic does not reliably reflect whether a bio is an
md cloned bio. When a failed bio is split and resubmitted via
bio_submit_split_bioset() on the error path, this can lead to either
double accounting for md cloned bios, or missing accounting for bios
returned from bio_submit_split_bioset()

Fix this by using md_cloned_bio() to detect md cloned bios and
skip accounting accordingly.

Fixes: bb2a9acefaf9 ("md/raid1: switch to use md_account_bio() for io accounting")
Fixes: 820455238366 ("md/raid10: switch to use md_account_bio() for io accounting")
Signed-off-by: Abd-Alrhman Masalkhi &lt;abd.masalkhi@gmail.com&gt;
Reviewed-by: Xiao Ni &lt;xiao@kernel.org&gt;
Link: https://patch.msgid.link/20260501114652.590037-4-abd.masalkhi@gmail.com
Signed-off-by: Yu Kuai &lt;yukuai@fygo.io&gt;
</content>
</entry>
</feed>
