Skip to content

Commit f4a8e65

Browse files
Jan Schmidtchrismason-xx
authored andcommitted
Btrfs: fix meta data raid-repair merge problem
Commit 4a54c8c introduced raid-repair, killing the individual readpage_io_failed_hook entries from inode.c and disk-io.c. Commit 4bb31e9 introduced new readahead code, adding a readpage_io_failed_hook to disk-io.c. The raid-repair commit had logic to disable raid-repair, if readpage_io_failed_hook is set. Thus, the readahead commit effectively disabled raid-repair for meta data. This commit changes the logic to always attempt raid-repair when needed and call the readpage_io_failed_hook in case raid-repair fails. This is much more straight forward and should have been like that from the beginning. Signed-off-by: Jan Schmidt <[email protected]> Reported-by: Stefan Behrens <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent be064d1 commit f4a8e65

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

fs/btrfs/extent_io.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,21 +2287,34 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
22872287
if (!uptodate) {
22882288
int failed_mirror;
22892289
failed_mirror = (int)(unsigned long)bio->bi_bdev;
2290-
if (tree->ops && tree->ops->readpage_io_failed_hook)
2291-
ret = tree->ops->readpage_io_failed_hook(
2292-
bio, page, start, end,
2293-
failed_mirror, state);
2294-
else
2295-
ret = bio_readpage_error(bio, page, start, end,
2296-
failed_mirror, NULL);
2290+
/*
2291+
* The generic bio_readpage_error handles errors the
2292+
* following way: If possible, new read requests are
2293+
* created and submitted and will end up in
2294+
* end_bio_extent_readpage as well (if we're lucky, not
2295+
* in the !uptodate case). In that case it returns 0 and
2296+
* we just go on with the next page in our bio. If it
2297+
* can't handle the error it will return -EIO and we
2298+
* remain responsible for that page.
2299+
*/
2300+
ret = bio_readpage_error(bio, page, start, end,
2301+
failed_mirror, NULL);
22972302
if (ret == 0) {
2303+
error_handled:
22982304
uptodate =
22992305
test_bit(BIO_UPTODATE, &bio->bi_flags);
23002306
if (err)
23012307
uptodate = 0;
23022308
uncache_state(&cached);
23032309
continue;
23042310
}
2311+
if (tree->ops && tree->ops->readpage_io_failed_hook) {
2312+
ret = tree->ops->readpage_io_failed_hook(
2313+
bio, page, start, end,
2314+
failed_mirror, state);
2315+
if (ret == 0)
2316+
goto error_handled;
2317+
}
23052318
}
23062319

23072320
if (uptodate) {

0 commit comments

Comments
 (0)