Mdmonitor: Omit non-md devices
PATCH 1/1 Mdmonitor: Omit non-md devices
Fix segfault commit [1] introduced check whether given device is mddevice, but it happend to terminate Mdmonitor if at least one of given devices didn't fulfill that condition. In result Mdmonitor service was no longer started on boot (with --scan option) when config contained some non-existent array entry.
This commit introduces ommiting non-md devices so scan option can still be used when config is wrong and allow Mdmonitor service to run on boot.
Giving a list of devices to monitor containing non-existing or non-md devices will result in monitoring only confirmed mddevices.
--- Monitor.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
Monitor.c +4 -8
@@ -185,10 +185,8 @@ int Monitor(struct mddev_dev *devlist,continue ;if (strcasecmp (mdlist->devname,"<ignore>" ) ==0 )continue ; -if (!is_mddev (mdlist->devname)) { -free_statelist (statelist); -return 1 ; - } +if (!is_mddev (mdlist->devname)) +continue ; st =xcalloc (1 ,sizeof *st); snprintf(st->devname, MD_NAME_MAX + sizeof("/dev/md/"),
@@ -208,10 +206,8 @@ int Monitor(struct mddev_dev *devlist,for (dv = devlist; dv; dv = dv->next) {struct state *st; -if (!is_mddev (dv->devname)) { -free_statelist (statelist); -return 1 ; - } +if (!is_mddev (dv->devname)) +continue ; st =xcalloc (1 ,sizeof *st); mdlist =conf_get_ident (dv->devname);
Signature · 1 line
2.26.2
Jes Sorensen
AppliedQuoted 9 lines · Lukasz Florczak
Fix segfault commit [1] introduced check whether given device is mddevice, but it happend to terminate Mdmonitor if at least one of given devices didn't fulfill that condition. In result Mdmonitor service was no longer started on boot (with --scan option) when config contained some non-existent array entry.
This commit introduces ommiting non-md devices so scan option can still be used when config is wrong and allow Mdmonitor service to run on boot.
Quoted 6 lines
Giving a list of devices to monitor containing non-existing or non-md devices will result in monitoring only confirmed mddevices.
Signed-off-by Lukasz Florczak <[email protected]>
Applied!
Thanks,
Jes