We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a4c604 commit 879a73bCopy full SHA for 879a73b
drivers/md/raid1.c
@@ -1813,6 +1813,17 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
1813
struct md_rdev *repl =
1814
conf->mirrors[conf->raid_disks + number].rdev;
1815
freeze_array(conf, 0);
1816
+ if (atomic_read(&repl->nr_pending)) {
1817
+ /* It means that some queued IO of retry_list
1818
+ * hold repl. Thus, we cannot set replacement
1819
+ * as NULL, avoiding rdev NULL pointer
1820
+ * dereference in sync_request_write and
1821
+ * handle_write_finished.
1822
+ */
1823
+ err = -EBUSY;
1824
+ unfreeze_array(conf);
1825
+ goto abort;
1826
+ }
1827
clear_bit(Replacement, &repl->flags);
1828
p->rdev = repl;
1829
conf->mirrors[conf->raid_disks + number].rdev = NULL;
0 commit comments