]> git.baikalelectronics.ru Git - kernel.git/commit
md/raid1: fix read balance when a drive is write-mostly.
authorTomáš Hodek <tomas.hodek@volny.cz>
Mon, 23 Feb 2015 00:00:38 +0000 (11:00 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 25 Feb 2015 00:37:02 +0000 (11:37 +1100)
commit1f5675322688b9fbeeeb782ef68d8b1090e89155
tree75becab74c257df726f895e5dc477f2883cd34b9
parent9cbe621030a9cce16d27329dac74fd4b1c1d9412
md/raid1: fix read balance when a drive is write-mostly.

When a drive is marked write-mostly it should only be the
target of reads if there is no other option.

This behaviour was broken by

commit ce2c7b1e077ae79a86d20490c471c5da13c52a0e
    md/raid1: read balance chooses idlest disk for SSD

which causes a write-mostly device to be *preferred* is some cases.

Restore correct behaviour by checking and setting
best_dist_disk and best_pending_disk rather than best_disk.

We only need to test one of these as they are both changed
from -1 or >=0 at the same time.

As we leave min_pending and best_dist unchanged, any non-write-mostly
device will appear better than the write-mostly device.

Reported-by: Tomáš Hodek <tomas.hodek@volny.cz>
Reported-by: Dark Penguin <darkpenguin@yandex.ru>
Signed-off-by: NeilBrown <neilb@suse.de>
Link: http://marc.info/?l=linux-raid&m=135982797322422
Fixes: ce2c7b1e077ae79a86d20490c471c5da13c52a0e
Cc: stable@vger.kernel.org (3.6+)
drivers/md/raid1.c