Skip to content

Commit c887037

Browse files
mtkaczykliu-song-6
authored andcommitted
md: Put the right device in md_seq_next
If there are multiple arrays in system and one mddevice is marked with MD_DELETED and md_seq_next() is called in the middle of removal then it _get()s proper device but it may _put() deleted one. As a result, active counter may never be zeroed for mddevice and it cannot be removed. Put the device which has been _get with previous md_seq_next() call. Cc: [email protected] Fixes: 12a6caf ("md: only delete entries from all_mddevs when the disk is freed") Reported-by: AceLan Kao <[email protected]> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217798 Cc: Yu Kuai <[email protected]> Signed-off-by: Mariusz Tkaczyk <[email protected]> Signed-off-by: Song Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent df203da commit c887037

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/md/md.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8265,7 +8265,7 @@ static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos)
82658265
spin_unlock(&all_mddevs_lock);
82668266

82678267
if (to_put)
8268-
mddev_put(mddev);
8268+
mddev_put(to_put);
82698269
return next_mddev;
82708270

82718271
}

0 commit comments

Comments
 (0)