提交 5026d7a9 编写于 作者: H H. Peter Anvin 提交者: NeilBrown

md/raid1,5,10: Disable WRITE SAME until a recovery strategy is in place

There are cases where the kernel will believe that the WRITE SAME
command is supported by a block device which does not, in fact,
support WRITE SAME.  This currently happens for SATA drivers behind a
SAS controller, but there are probably a hundred other ways that can
happen, including drive firmware bugs.

After receiving an error for WRITE SAME the block layer will retry the
request as a plain write of zeroes, but mdraid will consider the
failure as fatal and consider the drive failed.  This has the effect
that all the mirrors containing a specific set of data are each
offlined in very rapid succession resulting in data loss.

However, just bouncing the request back up to the block layer isn't
ideal either, because the whole initial request-retry sequence should
be inside the write bitmap fence, which probably means that md needs
to do its own conversion of WRITE SAME to write zero.

Until the failure scenario has been sorted out, disable WRITE SAME for
raid1, raid5, and raid10.

[neilb: added raid5]

This patch is appropriate for any -stable since 3.7 when write_same
support was added.

Cc: stable@vger.kernel.org
Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: NNeilBrown <neilb@suse.de>
上级 e2d59925
...@@ -2837,8 +2837,8 @@ static int run(struct mddev *mddev) ...@@ -2837,8 +2837,8 @@ static int run(struct mddev *mddev)
return PTR_ERR(conf); return PTR_ERR(conf);
if (mddev->queue) if (mddev->queue)
blk_queue_max_write_same_sectors(mddev->queue, blk_queue_max_write_same_sectors(mddev->queue, 0);
mddev->chunk_sectors);
rdev_for_each(rdev, mddev) { rdev_for_each(rdev, mddev) {
if (!mddev->gendisk) if (!mddev->gendisk)
continue; continue;
......
...@@ -3651,8 +3651,7 @@ static int run(struct mddev *mddev) ...@@ -3651,8 +3651,7 @@ static int run(struct mddev *mddev)
if (mddev->queue) { if (mddev->queue) {
blk_queue_max_discard_sectors(mddev->queue, blk_queue_max_discard_sectors(mddev->queue,
mddev->chunk_sectors); mddev->chunk_sectors);
blk_queue_max_write_same_sectors(mddev->queue, blk_queue_max_write_same_sectors(mddev->queue, 0);
mddev->chunk_sectors);
blk_queue_io_min(mddev->queue, chunk_size); blk_queue_io_min(mddev->queue, chunk_size);
if (conf->geo.raid_disks % conf->geo.near_copies) if (conf->geo.raid_disks % conf->geo.near_copies)
blk_queue_io_opt(mddev->queue, chunk_size * conf->geo.raid_disks); blk_queue_io_opt(mddev->queue, chunk_size * conf->geo.raid_disks);
......
...@@ -5588,6 +5588,8 @@ static int run(struct mddev *mddev) ...@@ -5588,6 +5588,8 @@ static int run(struct mddev *mddev)
*/ */
mddev->queue->limits.discard_zeroes_data = 0; mddev->queue->limits.discard_zeroes_data = 0;
blk_queue_max_write_same_sectors(mddev->queue, 0);
rdev_for_each(rdev, mddev) { rdev_for_each(rdev, mddev) {
disk_stack_limits(mddev->gendisk, rdev->bdev, disk_stack_limits(mddev->gendisk, rdev->bdev,
rdev->data_offset << 9); rdev->data_offset << 9);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册