diff options
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 0d016a844ec6..0222ba1a6d35 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -961,11 +961,11 @@ static void handle_stripe(struct stripe_head *sh) | |||
961 | syncing = test_bit(STRIPE_SYNCING, &sh->state); | 961 | syncing = test_bit(STRIPE_SYNCING, &sh->state); |
962 | /* Now to look around and see what can be done */ | 962 | /* Now to look around and see what can be done */ |
963 | 963 | ||
964 | rcu_read_lock(); | ||
964 | for (i=disks; i--; ) { | 965 | for (i=disks; i--; ) { |
965 | mdk_rdev_t *rdev; | 966 | mdk_rdev_t *rdev; |
966 | dev = &sh->dev[i]; | 967 | dev = &sh->dev[i]; |
967 | clear_bit(R5_Insync, &dev->flags); | 968 | clear_bit(R5_Insync, &dev->flags); |
968 | clear_bit(R5_Syncio, &dev->flags); | ||
969 | 969 | ||
970 | PRINTK("check %d: state 0x%lx read %p write %p written %p\n", | 970 | PRINTK("check %d: state 0x%lx read %p write %p written %p\n", |
971 | i, dev->flags, dev->toread, dev->towrite, dev->written); | 971 | i, dev->flags, dev->toread, dev->towrite, dev->written); |
@@ -1004,7 +1004,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
1004 | non_overwrite++; | 1004 | non_overwrite++; |
1005 | } | 1005 | } |
1006 | if (dev->written) written++; | 1006 | if (dev->written) written++; |
1007 | rdev = conf->disks[i].rdev; /* FIXME, should I be looking rdev */ | 1007 | rdev = rcu_dereference(conf->disks[i].rdev); |
1008 | if (!rdev || !test_bit(In_sync, &rdev->flags)) { | 1008 | if (!rdev || !test_bit(In_sync, &rdev->flags)) { |
1009 | /* The ReadError flag will just be confusing now */ | 1009 | /* The ReadError flag will just be confusing now */ |
1010 | clear_bit(R5_ReadError, &dev->flags); | 1010 | clear_bit(R5_ReadError, &dev->flags); |
@@ -1017,6 +1017,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
1017 | } else | 1017 | } else |
1018 | set_bit(R5_Insync, &dev->flags); | 1018 | set_bit(R5_Insync, &dev->flags); |
1019 | } | 1019 | } |
1020 | rcu_read_unlock(); | ||
1020 | PRINTK("locked=%d uptodate=%d to_read=%d" | 1021 | PRINTK("locked=%d uptodate=%d to_read=%d" |
1021 | " to_write=%d failed=%d failed_num=%d\n", | 1022 | " to_write=%d failed=%d failed_num=%d\n", |
1022 | locked, uptodate, to_read, to_write, failed, failed_num); | 1023 | locked, uptodate, to_read, to_write, failed, failed_num); |
@@ -1028,10 +1029,13 @@ static void handle_stripe(struct stripe_head *sh) | |||
1028 | int bitmap_end = 0; | 1029 | int bitmap_end = 0; |
1029 | 1030 | ||
1030 | if (test_bit(R5_ReadError, &sh->dev[i].flags)) { | 1031 | if (test_bit(R5_ReadError, &sh->dev[i].flags)) { |
1031 | mdk_rdev_t *rdev = conf->disks[i].rdev; | 1032 | mdk_rdev_t *rdev; |
1033 | rcu_read_lock(); | ||
1034 | rdev = rcu_dereference(conf->disks[i].rdev); | ||
1032 | if (rdev && test_bit(In_sync, &rdev->flags)) | 1035 | if (rdev && test_bit(In_sync, &rdev->flags)) |
1033 | /* multiple read failures in one stripe */ | 1036 | /* multiple read failures in one stripe */ |
1034 | md_error(conf->mddev, rdev); | 1037 | md_error(conf->mddev, rdev); |
1038 | rcu_read_unlock(); | ||
1035 | } | 1039 | } |
1036 | 1040 | ||
1037 | spin_lock_irq(&conf->device_lock); | 1041 | spin_lock_irq(&conf->device_lock); |
@@ -1180,9 +1184,6 @@ static void handle_stripe(struct stripe_head *sh) | |||
1180 | locked++; | 1184 | locked++; |
1181 | PRINTK("Reading block %d (sync=%d)\n", | 1185 | PRINTK("Reading block %d (sync=%d)\n", |
1182 | i, syncing); | 1186 | i, syncing); |
1183 | if (syncing) | ||
1184 | md_sync_acct(conf->disks[i].rdev->bdev, | ||
1185 | STRIPE_SECTORS); | ||
1186 | } | 1187 | } |
1187 | } | 1188 | } |
1188 | } | 1189 | } |
@@ -1326,7 +1327,6 @@ static void handle_stripe(struct stripe_head *sh) | |||
1326 | clear_bit(STRIPE_DEGRADED, &sh->state); | 1327 | clear_bit(STRIPE_DEGRADED, &sh->state); |
1327 | locked++; | 1328 | locked++; |
1328 | set_bit(STRIPE_INSYNC, &sh->state); | 1329 | set_bit(STRIPE_INSYNC, &sh->state); |
1329 | set_bit(R5_Syncio, &dev->flags); | ||
1330 | } | 1330 | } |
1331 | } | 1331 | } |
1332 | if (syncing && locked == 0 && test_bit(STRIPE_INSYNC, &sh->state)) { | 1332 | if (syncing && locked == 0 && test_bit(STRIPE_INSYNC, &sh->state)) { |
@@ -1392,7 +1392,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
1392 | rcu_read_unlock(); | 1392 | rcu_read_unlock(); |
1393 | 1393 | ||
1394 | if (rdev) { | 1394 | if (rdev) { |
1395 | if (test_bit(R5_Syncio, &sh->dev[i].flags)) | 1395 | if (syncing) |
1396 | md_sync_acct(rdev->bdev, STRIPE_SECTORS); | 1396 | md_sync_acct(rdev->bdev, STRIPE_SECTORS); |
1397 | 1397 | ||
1398 | bi->bi_bdev = rdev->bdev; | 1398 | bi->bi_bdev = rdev->bdev; |