Skip to content

Commit

Permalink
[PATCH] md: fix bitmap/read_sb_page so that it handles errors properly.
Browse files Browse the repository at this point in the history
read_sb_page() assumed that if sync_page_io fails, the device would be marked
faultly.  However it isn't.  So in the face of error, read_sb_page would loop
forever.

Redo the logic so that this cannot happen.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Sep 9, 2005
1 parent 71c0805 commit ab904d6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions drivers/md/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,20 @@ static struct page *read_sb_page(mddev_t *mddev, long offset, unsigned long inde

if (!page)
return ERR_PTR(-ENOMEM);
do {
ITERATE_RDEV(mddev, rdev, tmp)
if (rdev->in_sync && !rdev->faulty)
goto found;
return ERR_PTR(-EIO);

found:
ITERATE_RDEV(mddev, rdev, tmp) {
if (! rdev->in_sync || rdev->faulty)
continue;

target = (rdev->sb_offset << 1) + offset + index * (PAGE_SIZE/512);

} while (!sync_page_io(rdev->bdev, target, PAGE_SIZE, page, READ));
if (sync_page_io(rdev->bdev, target, PAGE_SIZE, page, READ)) {
page->index = index;
return page;
}
}
return ERR_PTR(-EIO);

page->index = index;
return page;
}

static int write_sb_page(mddev_t *mddev, long offset, struct page *page, int wait)
Expand Down

0 comments on commit ab904d6

Please sign in to comment.