sysfs: include faulty drive in disk count
PATCH 1/1 sysfs: include faulty drive in disk count
When the disk fails, it goes into faulty state first and it is removed from the array in a while. It gives mdadm monitor a chance to see the disk has failed and notify an event (e.g. FailSpare). It doesn't work when sysfs is used to get a number of disks in the array as it skips faulty disk. ioctl implementation doesn't differentiate between active and faulty disk. Do the same for sysfs then. It should not matter that number of disks reported is greater than list of disk structures returned by the call because the same approach already takes place for offline disks.
--- sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sysfs.c +1 -1
@@ -307,6 +307,7 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options) dev->disk.raid_disk =strtoul (buf, &ep,10 );if (*ep) dev->disk.raid_disk =-1 ; + sra->array.nr_disks++;strcpy (dbase,"block/dev" );if (load_sys (fname, buf,sizeof (buf))) {/* assume this is a stale reference to a hot
@@ -315,7 +316,6 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)free (dev);continue ; } - sra->array.nr_disks++;sscanf (buf,"%d:%d" , &dev->disk.major, &dev->disk.minor);/* special case check for block devices that can go 'offline' */
Signature · 1 line
1.8.3.1
Jes Sorensen
AppliedQuoted 9 lines · Mariusz Tkaczyk
When the disk fails, it goes into faulty state first and it is removed from the array in a while. It gives mdadm monitor a chance to see the disk has failed and notify an event (e.g. FailSpare). It doesn't work when sysfs is used to get a number of disks in the array as it skips faulty disk. ioctl implementation doesn't differentiate between active and faulty disk. Do the same for sysfs then. It should not matter that number of disks reported is greater than list of disk structures returned by the call because the same approach already takes place for offline disks.
Quoted 4 lines
Signed-off-by Mariusz Tkaczyk <[email protected]>--- sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied!
Thanks,
Jes
Quoted 15 lines · Jes Sorensen
Quoted 9 lines · Mariusz Tkaczyk
When the disk fails, it goes into faulty state first and it is removed from the array in a while. It gives mdadm monitor a chance to see the disk has failed and notify an event (e.g. FailSpare). It doesn't work when sysfs is used to get a number of disks in the array as it skips faulty disk. ioctl implementation doesn't differentiate between active and faulty disk. Do the same for sysfs then. It should not matter that number of disks reported is greater than list of disk structures returned by the call because the same approach already takes place for offline disks.
Quoted 4 lines
Signed-off-by Mariusz Tkaczyk <[email protected]>--- sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 4 lines
Applied!
Thanks,
Jes
Hi Jes,
Have you applied this patch? I don't see it on the repository. I see you applied "imsm: More precise message when spanned raid is created" but you haven't confirmed it by email.
Tomek
Quoted 18 lines · Tomasz Majchrzak
Quoted 17 lines · Jes Sorensen
Quoted 9 lines · Mariusz Tkaczyk
When the disk fails, it goes into faulty state first and it is removed from the array in a while. It gives mdadm monitor a chance to see the disk has failed and notify an event (e.g. FailSpare). It doesn't work when sysfs is used to get a number of disks in the array as it skips faulty disk. ioctl implementation doesn't differentiate between active and faulty disk. Do the same for sysfs then. It should not matter that number of disks reported is greater than list of disk structures returned by the call because the same approach already takes place for offline disks.
Quoted 4 lines
Signed-off-by Mariusz Tkaczyk <[email protected]>--- sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Applied!
Quoted 8 lines
Quoted 2 lines
Thanks,
JesHi Jes,
Have you applied this patch? I don't see it on the repository. I see you applied "imsm: More precise message when spanned raid is created" but you haven't confirmed it by email.
Hi Tomek,
It was there, but I had forgotten to push it. It should be in the public repo now.
Cheers,
Jes