]> git.baikalelectronics.ru Git - kernel.git/commit
md/raid1: only allocate write behind bio for WriteMostly device
authorGuoqing Jiang <guoqing.jiang@linux.dev>
Mon, 4 Oct 2021 15:34:48 +0000 (23:34 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Oct 2021 20:50:25 +0000 (14:50 -0600)
commitbb0aff2e5f3ec545c4bc63381ec0f643cc5b2a51
tree5eb2e9695bdee90a4a360abc7160dd1100505b07
parentfee490e12a536a2b8ba2727f80143d53d6dfcee4
md/raid1: only allocate write behind bio for WriteMostly device

Commit 4403d621e057592cb01e1115d35bb3e36aecf338 ("raid1: ensure write
behind bio has less than BIO_MAX_VECS sectors") tried to guarantee the
size of behind bio is not bigger than BIO_MAX_VECS sectors.

Unfortunately the same calltrace still could happen since an array could
enable write-behind without write mostly device.

To match the manpage of mdadm (which says "write-behind is only attempted
on drives marked as write-mostly"), we need to check WriteMostly flag to
avoid such unexpected behavior.

[1]. https://bugzilla.kernel.org/show_bug.cgi?id=213181#c25

Cc: stable@vger.kernel.org # v5.12+
Cc: Jens Stutte <jens@chianterastutte.eu>
Reported-by: Jens Stutte <jens@chianterastutte.eu>
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/raid1.c