* [PATCH v4 0/2] Mdmonitor improvements
@ 2022-06-06 10:32 Kinga Tanska
2022-06-06 10:32 ` [PATCH v4 1/2] Mdmonitor: Fix segfault Kinga Tanska
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Kinga Tanska @ 2022-06-06 10:32 UTC (permalink / raw)
To: linux-raid; +Cc: jes, colyli, pmenzel
Changes in v4:
- fix place where is_mddev is calling
- no new changes in "Mdmonitor: Improve logging method" patch
Kinga Tanska (2):
Mdmonitor: Fix segfault
Mdmonitor: Improve logging method
Monitor.c | 36 ++++++++++++++++++++++++------------
mdadm.h | 1 +
mdopen.c | 17 +++++++++++++++++
util.c | 2 +-
4 files changed, 43 insertions(+), 13 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v4 1/2] Mdmonitor: Fix segfault 2022-06-06 10:32 [PATCH v4 0/2] Mdmonitor improvements Kinga Tanska @ 2022-06-06 10:32 ` Kinga Tanska 2022-06-14 14:37 ` Jes Sorensen 2022-06-06 10:32 ` [PATCH v4 2/2] Mdmonitor: Improve logging method Kinga Tanska 2022-09-29 15:08 ` [PATCH v4 0/2] Mdmonitor improvements Jes Sorensen 2 siblings, 1 reply; 8+ messages in thread From: Kinga Tanska @ 2022-06-06 10:32 UTC (permalink / raw) To: linux-raid; +Cc: jes, colyli, pmenzel Mdadm with "--monitor" parameter requires md device as an argument to be monitored. If given argument is not a md device, error shall be returned. Previously it was not checked and invalid argument caused segmentation fault. This commit adds checking that devices passed to mdmonitor are md devices. Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> --- Monitor.c | 10 +++++++++- mdadm.h | 1 + mdopen.c | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Monitor.c b/Monitor.c index f5412299..3d0c147a 100644 --- a/Monitor.c +++ b/Monitor.c @@ -183,6 +183,7 @@ int Monitor(struct mddev_dev *devlist, continue; if (strcasecmp(mdlist->devname, "<ignore>") == 0) continue; + st = xcalloc(1, sizeof *st); if (mdlist->devname[0] == '/') st->devname = xstrdup(mdlist->devname); @@ -191,6 +192,8 @@ int Monitor(struct mddev_dev *devlist, strcpy(strcpy(st->devname, "/dev/md/"), mdlist->devname); } + if (!is_mddev(mdlist->devname)) + return 1; st->next = statelist; st->devnm[0] = 0; st->percent = RESYNC_UNKNOWN; @@ -204,7 +207,12 @@ int Monitor(struct mddev_dev *devlist, struct mddev_dev *dv; for (dv = devlist; dv; dv = dv->next) { - struct state *st = xcalloc(1, sizeof *st); + struct state *st; + + if (!is_mddev(dv->devname)) + return 1; + + st = xcalloc(1, sizeof *st); mdlist = conf_get_ident(dv->devname); st->devname = xstrdup(dv->devname); st->next = statelist; diff --git a/mdadm.h b/mdadm.h index 8f8841d8..03151c34 100644 --- a/mdadm.h +++ b/mdadm.h @@ -1607,6 +1607,7 @@ extern int create_mddev(char *dev, char *name, int autof, int trustworthy, #define FOREIGN 2 #define METADATA 3 extern int open_mddev(char *dev, int report_errors); +extern int is_mddev(char *dev); extern int open_container(int fd); extern int metadata_container_matches(char *metadata, char *devnm); extern int metadata_subdev_matches(char *metadata, char *devnm); diff --git a/mdopen.c b/mdopen.c index 245be537..d18c9319 100644 --- a/mdopen.c +++ b/mdopen.c @@ -475,6 +475,23 @@ int open_mddev(char *dev, int report_errors) return mdfd; } +/** + * is_mddev() - check that file name passed is an md device. + * @dev: file name that has to be checked. + * Return: 1 if file passed is an md device, 0 if not. + */ +int is_mddev(char *dev) +{ + int fd = open_mddev(dev, 1); + + if (fd >= 0) { + close(fd); + return 1; + } + + return 0; +} + char *find_free_devnm(int use_partitions) { static char devnm[32]; -- 2.26.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v4 1/2] Mdmonitor: Fix segfault 2022-06-06 10:32 ` [PATCH v4 1/2] Mdmonitor: Fix segfault Kinga Tanska @ 2022-06-14 14:37 ` Jes Sorensen 0 siblings, 0 replies; 8+ messages in thread From: Jes Sorensen @ 2022-06-14 14:37 UTC (permalink / raw) To: Kinga Tanska, linux-raid; +Cc: colyli, pmenzel On 6/6/22 06:32, Kinga Tanska wrote: > Mdadm with "--monitor" parameter requires md device > as an argument to be monitored. If given argument is > not a md device, error shall be returned. Previously > it was not checked and invalid argument caused > segmentation fault. This commit adds checking > that devices passed to mdmonitor are md devices. > > Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> > --- > Monitor.c | 10 +++++++++- > mdadm.h | 1 + > mdopen.c | 17 +++++++++++++++++ > 3 files changed, 27 insertions(+), 1 deletion(-) > Applied! Thanks, Jes ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v4 2/2] Mdmonitor: Improve logging method 2022-06-06 10:32 [PATCH v4 0/2] Mdmonitor improvements Kinga Tanska 2022-06-06 10:32 ` [PATCH v4 1/2] Mdmonitor: Fix segfault Kinga Tanska @ 2022-06-06 10:32 ` Kinga Tanska 2022-06-14 14:37 ` Jes Sorensen 2022-09-29 15:08 ` [PATCH v4 0/2] Mdmonitor improvements Jes Sorensen 2 siblings, 1 reply; 8+ messages in thread From: Kinga Tanska @ 2022-06-06 10:32 UTC (permalink / raw) To: linux-raid; +Cc: jes, colyli, pmenzel Change logging, and as a result, mdmonitor in verbose mode will report its configuration. Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> Signed-off-by: Oleksandr Shchirskyi <oleksandr.shchirskyi@intel.com> --- Monitor.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Monitor.c b/Monitor.c index 0b24b656..bd417d04 100644 --- a/Monitor.c +++ b/Monitor.c @@ -137,24 +137,27 @@ int Monitor(struct mddev_dev *devlist, struct mddev_ident *mdlist; int delay_for_event = c->delay; - if (!mailaddr) { + if (!mailaddr) mailaddr = conf_get_mailaddr(); - if (mailaddr && ! c->scan) - pr_err("Monitor using email address \"%s\" from config file\n", - mailaddr); - } - mailfrom = conf_get_mailfrom(); - if (!alert_cmd) { + if (!alert_cmd) alert_cmd = conf_get_program(); - if (alert_cmd && !c->scan) - pr_err("Monitor using program \"%s\" from config file\n", - alert_cmd); - } + + mailfrom = conf_get_mailfrom(); + if (c->scan && !mailaddr && !alert_cmd && !dosyslog) { pr_err("No mail address or alert command - not monitoring.\n"); return 1; } + + if (c->verbose) { + pr_err("Monitor is started with delay %ds\n", c->delay); + if (mailaddr) + pr_err("Monitor using email address %s\n", mailaddr); + if (alert_cmd) + pr_err("Monitor using program %s\n", alert_cmd); + } + info.alert_cmd = alert_cmd; info.mailaddr = mailaddr; info.mailfrom = mailfrom; -- 2.26.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v4 2/2] Mdmonitor: Improve logging method 2022-06-06 10:32 ` [PATCH v4 2/2] Mdmonitor: Improve logging method Kinga Tanska @ 2022-06-14 14:37 ` Jes Sorensen 0 siblings, 0 replies; 8+ messages in thread From: Jes Sorensen @ 2022-06-14 14:37 UTC (permalink / raw) To: Kinga Tanska, linux-raid; +Cc: colyli, pmenzel On 6/6/22 06:32, Kinga Tanska wrote: > Change logging, and as a result, mdmonitor in verbose > mode will report its configuration. > > Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> > Signed-off-by: Oleksandr Shchirskyi <oleksandr.shchirskyi@intel.com> > --- > Monitor.c | 25 ++++++++++++++----------- > 1 file changed, 14 insertions(+), 11 deletions(-) > Applied, Thanks, Jes ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/2] Mdmonitor improvements 2022-06-06 10:32 [PATCH v4 0/2] Mdmonitor improvements Kinga Tanska 2022-06-06 10:32 ` [PATCH v4 1/2] Mdmonitor: Fix segfault Kinga Tanska 2022-06-06 10:32 ` [PATCH v4 2/2] Mdmonitor: Improve logging method Kinga Tanska @ 2022-09-29 15:08 ` Jes Sorensen 2022-09-29 15:19 ` Coly Li 2 siblings, 1 reply; 8+ messages in thread From: Jes Sorensen @ 2022-09-29 15:08 UTC (permalink / raw) To: Kinga Tanska, linux-raid; +Cc: colyli, pmenzel On 6/6/22 06:32, Kinga Tanska wrote: > Changes in v4: > - fix place where is_mddev is calling > - no new changes in "Mdmonitor: Improve logging method" patch > > Kinga Tanska (2): > Mdmonitor: Fix segfault > Mdmonitor: Improve logging method > > Monitor.c | 36 ++++++++++++++++++++++++------------ > mdadm.h | 1 + > mdopen.c | 17 +++++++++++++++++ > util.c | 2 +- > 4 files changed, 43 insertions(+), 13 deletions(-) > Coly, I am curious why these are marked Changes-requested in patchwork as there are no replies in the thread. https://patchwork.kernel.org/project/linux-raid/patch/20220907125657.12192-2-mateusz.grzonka@intel.com/ Thanks, Jes ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/2] Mdmonitor improvements 2022-09-29 15:08 ` [PATCH v4 0/2] Mdmonitor improvements Jes Sorensen @ 2022-09-29 15:19 ` Coly Li 2022-09-29 15:29 ` Jes Sorensen 0 siblings, 1 reply; 8+ messages in thread From: Coly Li @ 2022-09-29 15:19 UTC (permalink / raw) To: Jes Sorensen; +Cc: Kinga Tanska, linux-raid, pmenzel > 2022年9月29日 23:08,Jes Sorensen <jes@trained-monkey.org> 写道: > > On 6/6/22 06:32, Kinga Tanska wrote: >> Changes in v4: >> - fix place where is_mddev is calling >> - no new changes in "Mdmonitor: Improve logging method" patch >> >> Kinga Tanska (2): >> Mdmonitor: Fix segfault >> Mdmonitor: Improve logging method >> >> Monitor.c | 36 ++++++++++++++++++++++++------------ >> mdadm.h | 1 + >> mdopen.c | 17 +++++++++++++++++ >> util.c | 2 +- >> 4 files changed, 43 insertions(+), 13 deletions(-) >> > > Coly, > > I am curious why these are marked Changes-requested in patchwork as > there are no replies in the thread. > > https://patchwork.kernel.org/project/linux-raid/patch/20220907125657.12192-2-mateusz.grzonka@intel.com/ Hi Jes, I noticed this too, and asked Mariusz offline why these patches disappeared from my delegation, and he didn’t know why neither. So I just continue to review this series regardless its patchwork state. This is something I am not familiar with, so the progress is a bit slow. Thanks. Coly Li ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/2] Mdmonitor improvements 2022-09-29 15:19 ` Coly Li @ 2022-09-29 15:29 ` Jes Sorensen 0 siblings, 0 replies; 8+ messages in thread From: Jes Sorensen @ 2022-09-29 15:29 UTC (permalink / raw) To: Coly Li; +Cc: Kinga Tanska, linux-raid, pmenzel On 9/29/22 11:19, Coly Li wrote: > > >> 2022年9月29日 23:08,Jes Sorensen <jes@trained-monkey.org> 写道: >> Coly, >> >> I am curious why these are marked Changes-requested in patchwork as >> there are no replies in the thread. >> >> https://patchwork.kernel.org/project/linux-raid/patch/20220907125657.12192-2-mateusz.grzonka@intel.com/ > > Hi Jes, > > I noticed this too, and asked Mariusz offline why these patches disappeared from my delegation, and he didn’t know why neither. So I just continue to review this series regardless its patchwork state. This is something I am not familiar with, so the progress is a bit slow. No worries, I changed the marking to under review. Thanks, Jes ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-09-29 15:30 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-06-06 10:32 [PATCH v4 0/2] Mdmonitor improvements Kinga Tanska 2022-06-06 10:32 ` [PATCH v4 1/2] Mdmonitor: Fix segfault Kinga Tanska 2022-06-14 14:37 ` Jes Sorensen 2022-06-06 10:32 ` [PATCH v4 2/2] Mdmonitor: Improve logging method Kinga Tanska 2022-06-14 14:37 ` Jes Sorensen 2022-09-29 15:08 ` [PATCH v4 0/2] Mdmonitor improvements Jes Sorensen 2022-09-29 15:19 ` Coly Li 2022-09-29 15:29 ` Jes Sorensen
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).