From: Jens Laas <jens.laas@data.slu.se>
To: linux-raid@vger.kernel.org
Cc: jens.laas@data.slu.se
Subject: possible logic bug in raid5.c
Date: Fri, 1 Jun 2007 10:31:40 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.0706011012150.7173@localhost> (raw)
Hello!
It appears to me that raid5 assumes the number of raid_disks (in
conf-raid_disks for example) to directly map to the rdev list in mddev.
This is not always the case. We encountered the problem when we had one
"ghost" device in this list. Maybe this can be triggered some other way
too.
Example:
in run() in raid5.c
when counting working_disks:
ITERATE_RDEV(mddev,rdev,tmp) {
raid_disk = rdev->raid_disk;
if (raid_disk >= conf->raid_disks
|| raid_disk < 0)
continue;
If there are more disks in mddev's list than conf->raid_disks this loop
will ignore the tail of the list.
The test "if (raid_disk >= conf->raid_disks" makes sure that in our case
the "ghost" disk is tested (and not added) and the following disk (which
is a working raid disk) is ignored.
Without being familiar with the code I think it should either make sure
that "ghost" devices cannot be added or that the above kind of tests are
changed.
In our "ghost"-disk case this is what mdadm reports:
(some parts of output deleted)
$ mdadm --detail /dev/md0
Raid Devices : 4
Total Devices : 4
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Number Major Minor RaidDevice State
0 8 33 0 active sync /dev/sdc1
1 8 49 1 active sync /dev/sdd1
2 8 65 2 active sync /dev/sde1
3 0 0 3 removed
4 8 81 4 active sync /dev/sdf1
This is how it looks like in /sys:
# ls -l /sys/block/md0/md/
total 0
-rw-r--r-- 1 root root 4096 Jun 1 10:27 array_state
--w------- 1 root root 4096 Jun 1 10:27 bitmap_set_bits
-rw-r--r-- 1 root root 4096 Jun 1 10:27 chunk_size
-rw-r--r-- 1 root root 4096 Jun 1 10:27 component_size
drwxr-xr-x 2 root root 0 Jun 1 09:47 dev-sdc1
drwxr-xr-x 2 root root 0 Jun 1 02:27 dev-sdd1
drwxr-xr-x 2 root root 0 Jun 1 02:27 dev-sde1
drwxr-xr-x 2 root root 0 Jun 1 02:27 dev-sdf1
-rw-r--r-- 1 root root 4096 Jun 1 10:27 layout
-rw-r--r-- 1 root root 4096 Jun 1 10:27 level
-rw-r--r-- 1 root root 4096 Jun 1 10:27 metadata_version
-r--r--r-- 1 root root 4096 Jun 1 10:27 mismatch_cnt
--w------- 1 root root 4096 Jun 1 10:27 new_dev
-rw-r--r-- 1 root root 4096 Jun 1 10:27 raid_disks
lrwxrwxrwx 1 root root 0 Jun 1 10:27 rd0 ->
../../../block/md0/md/dev-sdc1
lrwxrwxrwx 1 root root 0 Jun 1 10:27 rd1 ->
../../../block/md0/md/dev-sdd1
lrwxrwxrwx 1 root root 0 Jun 1 10:27 rd2 ->
../../../block/md0/md/dev-sde1
lrwxrwxrwx 1 root root 0 Jun 1 10:27 rd4 ->
../../../block/md0/md/dev-sdf1
Cheers,
Jens Låås
-----------------------------------------------------------------------
'In theory, there is no difference between theory and practice.
But, in practice, there is.'
-----------------------------------------------------------------------
Jens Låås Email: jens.laas@data.slu.se
Department of Computer Services, SLU Phone: +46 18 67 35 15
Vindbrovägen 1
P.O. Box 7079
S-750 07 Uppsala
SWEDEN
-----------------------------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
reply other threads:[~2007-06-01 8:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0706011012150.7173@localhost \
--to=jens.laas@data.slu.se \
--cc=linux-raid@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).