mbox series

[0/2] util/log: Make the per-thread flag immutable

Message ID 20221104120059.678470-1-groug@kaod.org (mailing list archive)
Headers show
Series util/log: Make the per-thread flag immutable | expand

Message

Greg Kurz Nov. 4, 2022, noon UTC
While working on the "util/log: Always send errors to logfile when daemonized"
series [1], I've encountered some issues with the per-thread flag. They stem
from the code not being designed to allow the per-thread flag to be enabled
or disabled more than once, but nothing is done to prevent that from
happening. This results in unexpected results like the creation of a log
file with a `%d` in its name or confusing errors when using the `log`
command in the monitor.

I'm posting fixes separately now in case it makes sense to merge them during
soft freeze. If so, I'll open an issue as explained in this recent mail [2].

[1] https://patchew.org/QEMU/20221019151651.334334-1-groug@kaod.org/
[2] https://lists.nongnu.org/archive/html/qemu-devel/2022-11/msg00137.html

Date: Wed, 19 Oct 2022 17:16:49 +0200
Message-ID: <20221019151651.334334-1-groug@kaod.org>

Greg Kurz (2):
  util/log: Make the per-thread flag immutable
  util/log: Ignore per-thread flag if global file already there

 util/log.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Richard Henderson Nov. 4, 2022, 10:37 p.m. UTC | #1
On 11/4/22 23:00, Greg Kurz wrote:
> While working on the "util/log: Always send errors to logfile when daemonized"
> series [1], I've encountered some issues with the per-thread flag. They stem
> from the code not being designed to allow the per-thread flag to be enabled
> or disabled more than once, but nothing is done to prevent that from
> happening. This results in unexpected results like the creation of a log
> file with a `%d` in its name or confusing errors when using the `log`
> command in the monitor.
> 
> I'm posting fixes separately now in case it makes sense to merge them during
> soft freeze. If so, I'll open an issue as explained in this recent mail [2].
> 
> [1] https://patchew.org/QEMU/20221019151651.334334-1-groug@kaod.org/
> [2] https://lists.nongnu.org/archive/html/qemu-devel/2022-11/msg00137.html
> 
> Date: Wed, 19 Oct 2022 17:16:49 +0200
> Message-ID: <20221019151651.334334-1-groug@kaod.org>
> 
> Greg Kurz (2):
>    util/log: Make the per-thread flag immutable
>    util/log: Ignore per-thread flag if global file already there
> 
>   util/log.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 

Series:
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
Greg Kurz Nov. 7, 2022, 12:34 p.m. UTC | #2
On Sat, 5 Nov 2022 09:37:26 +1100
Richard Henderson <richard.henderson@linaro.org> wrote:

> On 11/4/22 23:00, Greg Kurz wrote:
> > While working on the "util/log: Always send errors to logfile when daemonized"
> > series [1], I've encountered some issues with the per-thread flag. They stem
> > from the code not being designed to allow the per-thread flag to be enabled
> > or disabled more than once, but nothing is done to prevent that from
> > happening. This results in unexpected results like the creation of a log
> > file with a `%d` in its name or confusing errors when using the `log`
> > command in the monitor.
> > 
> > I'm posting fixes separately now in case it makes sense to merge them during
> > soft freeze. If so, I'll open an issue as explained in this recent mail [2].
> > 
> > [1] https://patchew.org/QEMU/20221019151651.334334-1-groug@kaod.org/
> > [2] https://lists.nongnu.org/archive/html/qemu-devel/2022-11/msg00137.html
> > 
> > Date: Wed, 19 Oct 2022 17:16:49 +0200
> > Message-ID: <20221019151651.334334-1-groug@kaod.org>
> > 
> > Greg Kurz (2):
> >    util/log: Make the per-thread flag immutable
> >    util/log: Ignore per-thread flag if global file already there
> > 
> >   util/log.c | 9 +++++++++
> >   1 file changed, 9 insertions(+)
> > 
> 
> Series:
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> 

Thanks for the quick review Richard !

I've created https://gitlab.com/qemu-project/qemu/-/issues/1302 with
a 7.2 milestone.

Paolo,

Can you queue this ?

Cheers,

--
Greg

> 
> r~
Stefan Hajnoczi Nov. 7, 2022, 9:01 p.m. UTC | #3
On Mon, 7 Nov 2022 at 07:36, Greg Kurz <groug@kaod.org> wrote:
>
> On Sat, 5 Nov 2022 09:37:26 +1100
> Richard Henderson <richard.henderson@linaro.org> wrote:
>
> > On 11/4/22 23:00, Greg Kurz wrote:
> > > While working on the "util/log: Always send errors to logfile when daemonized"
> > > series [1], I've encountered some issues with the per-thread flag. They stem
> > > from the code not being designed to allow the per-thread flag to be enabled
> > > or disabled more than once, but nothing is done to prevent that from
> > > happening. This results in unexpected results like the creation of a log
> > > file with a `%d` in its name or confusing errors when using the `log`
> > > command in the monitor.
> > >
> > > I'm posting fixes separately now in case it makes sense to merge them during
> > > soft freeze. If so, I'll open an issue as explained in this recent mail [2].
> > >
> > > [1] https://patchew.org/QEMU/20221019151651.334334-1-groug@kaod.org/
> > > [2] https://lists.nongnu.org/archive/html/qemu-devel/2022-11/msg00137.html
> > >
> > > Date: Wed, 19 Oct 2022 17:16:49 +0200
> > > Message-ID: <20221019151651.334334-1-groug@kaod.org>
> > >
> > > Greg Kurz (2):
> > >    util/log: Make the per-thread flag immutable
> > >    util/log: Ignore per-thread flag if global file already there
> > >
> > >   util/log.c | 9 +++++++++
> > >   1 file changed, 9 insertions(+)
> > >
> >
> > Series:
> > Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> >
>
> Thanks for the quick review Richard !
>
> I've created https://gitlab.com/qemu-project/qemu/-/issues/1302 with
> a 7.2 milestone.
>
> Paolo,
>
> Can you queue this ?

I've applied it to the staging branch.

Stefan
Stefan Hajnoczi Nov. 7, 2022, 11:44 p.m. UTC | #4
Merged, thanks!

Stefan