* [PATCH] md: fix max_disks check in analyze_sbs
@ 2012-12-07 12:30 Sebastian Riemer
0 siblings, 0 replies; only message in thread
From: Sebastian Riemer @ 2012-12-07 12:30 UTC (permalink / raw)
To: linux-raid; +Cc: Sebastian Riemer
The number of disks starts at zero and is directly compared to
greater than max_disks. The check has to start at one.
Furthermore, the number of disks is only updated if the level is
multipath. For all other levels max_disks is always compared
against zero.
So make the number of disks count right for all levels.
Signed-off-by: Sebastian Riemer <sebastian.riemer@profitbricks.com>
---
drivers/md/md.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 6120071..f93fc79 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3337,7 +3337,7 @@ static void analyze_sbs(struct mddev * mddev)
rdev_for_each_safe(rdev, tmp, mddev) {
if (mddev->max_disks &&
(rdev->desc_nr >= mddev->max_disks ||
- i > mddev->max_disks)) {
+ i+1 > mddev->max_disks)) {
printk(KERN_WARNING
"md: %s: %s: only %d devices permitted\n",
mdname(mddev), bdevname(rdev->bdev, b),
@@ -3355,13 +3355,14 @@ static void analyze_sbs(struct mddev * mddev)
continue;
}
if (mddev->level == LEVEL_MULTIPATH) {
- rdev->desc_nr = i++;
+ rdev->desc_nr = i;
rdev->raid_disk = rdev->desc_nr;
set_bit(In_sync, &rdev->flags);
} else if (rdev->raid_disk >= (mddev->raid_disks - min(0, mddev->delta_disks))) {
rdev->raid_disk = -1;
clear_bit(In_sync, &rdev->flags);
}
+ i++;
}
}
--
1.7.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-12-07 12:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-07 12:30 [PATCH] md: fix max_disks check in analyze_sbs Sebastian Riemer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).