-
Notifications
You must be signed in to change notification settings - Fork 2
md/raid1,raid10: don't broken array on failfast metadata write fails #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kpd-daemon
wants to merge
3
commits into
md-6.16_base
Choose a base branch
from
series/990464=>md-6.16
base: md-6.16_base
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Author
|
Upstream branch: c17fb54 |
A super_write IO failure with MD_FAILFAST must not cause the array to fail. Because a failfast bio may fail even when the rdev is not broken, so IO must be retried rather than failing the array when a metadata write with MD_FAILFAST fails on the last rdev. A metadata write with MD_FAILFAST is retried after failure as follows: 1. In super_written, MD_SB_NEED_REWRITE is set in sb_flags. 2. In md_super_wait, which is called by the function that executed md_super_write and waits for completion, -EAGAIN is returned because MD_SB_NEED_REWRITE is set. 3. The caller of md_super_wait (such as md_update_sb) receives a negative return value and then retries md_super_write. 4. The md_super_write function, which is called to perform the same metadata write, issues a write bio without MD_FAILFAST this time. When a write from super_written without MD_FAILFAST fails, the array may broken, and MD_BROKEN should be set. After commit 9631abd ("md: Set MD_BROKEN for RAID1 and RAID10"), calling md_error on the last rdev in RAID1/10 always sets the MD_BROKEN flag on the array. As a result, when failfast IO fails on the last rdev, the array immediately becomes failed. This commit prevents MD_BROKEN from being set when a super_write with MD_FAILFAST fails on the last rdev, ensuring that the array does not become failed due to failfast IO failures. Failfast IO failures on any rdev except the last one are not retried and are marked as Faulty immediately. This minimizes array IO latency when an rdev fails. Fixes: 9631abd ("md: Set MD_BROKEN for RAID1 and RAID10") Signed-off-by: Kenta Akagi <k@mgml.me>
Author
|
Upstream branch: c17fb54 |
Once MD_BROKEN is set on an array, no further writes can be performed to it. The user must be informed that the array cannot continue operation. Signed-off-by: Kenta Akagi <k@mgml.me>
Since commit 9a56784 ("md: allow last device to be forcibly removed from RAID1/RAID10."), RAID1/10 arrays can now lose all rdevs. Before that commit, losing the array last rdev or reaching the end of the function without early return in raid{1,10}_error never occurred. However, both situations can occur in the current implementation. As a result, when mddev->fail_last_dev is set, a spurious pr_crit message can be printed. This patch prevents "Operation continuing" printed if the array is not operational. root@fedora:~# mdadm --create --verbose /dev/md0 --level=1 \ --raid-devices=2 /dev/loop0 /dev/loop1 mdadm: Note: this array has metadata at the start and may not be suitable as a boot device. If you plan to store '/boot' on this device please ensure that your boot-loader understands md/v1.x metadata, or use --metadata=0.90 mdadm: size set to 1046528K Continue creating array? y mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md0 started. root@fedora:~# echo 1 > /sys/block/md0/md/fail_last_dev root@fedora:~# mdadm --fail /dev/md0 loop0 mdadm: set loop0 faulty in /dev/md0 root@fedora:~# mdadm --fail /dev/md0 loop1 mdadm: set device faulty failed for loop1: Device or resource busy root@fedora:~# dmesg | tail -n 4 [ 1314.359674] md/raid1:md0: Disk failure on loop0, disabling device. md/raid1:md0: Operation continuing on 1 devices. [ 1315.506633] md/raid1:md0: Disk failure on loop1, disabling device. md/raid1:md0: Operation continuing on 0 devices. root@fedora:~# Fixes: 9a56784 ("md: allow last device to be forcibly removed from RAID1/RAID10.") Signed-off-by: Kenta Akagi <k@mgml.me>
17a3273 to
7b74857
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: md/raid1,raid10: don't broken array on failfast metadata write fails
version: 1
url: https://patchwork.kernel.org/project/linux-raid/list/?series=990464