瀏覽代碼

md/raid10: fix refounct imbalance when resyncing an array with a replacement device.

If you have a raid10 with a replacement device that is resyncing -
e.g. after a crash before the replacement was complete - the write to
the replacement will increment nr_pending on the wrong device, which
will lead to strangeness.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
NeilBrown 9 年之前
父節點
當前提交
83f1261f5e
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/md/raid10.c

+ 1 - 1
drivers/md/raid10.c

@@ -3229,7 +3229,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 			bio->bi_error = -EIO;
 			bio->bi_error = -EIO;
 
 
 			sector = r10_bio->devs[i].addr;
 			sector = r10_bio->devs[i].addr;
-			atomic_inc(&conf->mirrors[d].rdev->nr_pending);
+			atomic_inc(&conf->mirrors[d].replacement->nr_pending);
 			bio->bi_next = biolist;
 			bio->bi_next = biolist;
 			biolist = bio;
 			biolist = bio;
 			bio->bi_private = r10_bio;
 			bio->bi_private = r10_bio;