The patch titled

     md: fix bitmap/read_sb_page so that it handles errors properly.

has been added to the -mm tree.  Its filename is

     md-fix-bitmap-read_sb_page-so-that-it-handles-errors-properly.patch

Patches currently in -mm which might be from [EMAIL PROTECTED] are

md-make-sure-resync-gets-started-when-array-starts.patch
sunrpc-cache_register-can-use-wrong-module-reference.patch
md-fix-minor-error-in-raid10-read-balancing-calculation.patch
md-fail-io-request-to-md-that-require-a-barrier.patch
md-dont-allow-new-md-bitmap-file-to-be-set-if-one-already-exists.patch
md-improve-handling-of-bitmap-initialisation.patch
md-all-hot-add-and-hot-remove-of-md-intent-logging-bitmaps.patch
md-support-write-mostly-device-in-raid1.patch
md-add-write-behind-support-for-md-raid1.patch
md-support-md-linear-array-with-components-greater-than-2-terabytes.patch
md-raid1_quiesce-is-back-to-front-fix-it.patch
md-make-sure-bitmap_daemon_work-actually-does-work.patch
md-do-not-set-mddev-bitmap-until-bitmap-is-fully-initialised.patch
md-allow-hot-adding-devices-to-arrays-with-non-persistant-superblocks.patch
md-allow-md-to-load-a-superblock-with-feature-bit-1-set.patch
md-fix-bitmap-read_sb_page-so-that-it-handles-errors-properly.patch
drivers-md-fix-up-schedule_timeout-usage.patch



From: NeilBrown <[EMAIL PROTECTED]>

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 <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 drivers/md/bitmap.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff -puN 
drivers/md/bitmap.c~md-fix-bitmap-read_sb_page-so-that-it-handles-errors-properly
 drivers/md/bitmap.c
--- 
devel/drivers/md/bitmap.c~md-fix-bitmap-read_sb_page-so-that-it-handles-errors-properly
     2005-08-21 22:36:04.000000000 -0700
+++ devel-akpm/drivers/md/bitmap.c      2005-08-21 22:36:04.000000000 -0700
@@ -270,19 +270,20 @@ static struct page *read_sb_page(mddev_t
 
        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)
_
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to