[ovs-dev] [PATCH] fatal-signal: Skip acquiring log fd lock.

William Tu u9012063 at gmail.com
Mon Mar 23 22:34:12 UTC 2020


On Mon, Mar 23, 2020 at 2:58 PM William Tu <u9012063 at gmail.com> wrote:
>
> On Mon, Mar 23, 2020 at 2:34 PM Ben Pfaff <blp at ovn.org> wrote:
> >
> > On Mon, Mar 23, 2020 at 02:22:17PM -0700, William Tu wrote:
> > > Due to not acquiring lock, clang reports:
> > >   lib/vlog.c:618:12: error: reading variable 'log_fd' requires holding mutex
> > >   'log_file_mutex' [-Werror,-Wthread-safety-analysis]
> > >   return log_fd;
> > > The patch fixes by skipping it using OVS_NO_THREAD_SAFETY_ANALYSIS.
> > >
> > > Tested-at: https://travis-ci.org/github/williamtu/ovs-travis/builds/666051210
> > > Fixex: ecd4a8fcdff2 ("fatal-signal: Log backtrace when no monitor daemon.")
> > > Signed-off-by: William Tu <u9012063 at gmail.com>
> >
> > You can't just mark the existing send_backtrace_to_monitor()
> > OVS_NO_THREAD_SAFETY_ANALYSIS?  It seems like the easiest change.
> OK
> that will also work.
> >
> > Also, the OVS_REQUIRES should also go in vlog.h.

Adding 'OVS_REQUIRES(log_file_mutext)' to vlog.h has error like this:
./include/openvswitch/vlog.h:147:36: error: use of undeclared
identifier 'log_file_mutex'
int vlog_get_fd(void) OVS_REQUIRES(log_file_mutex);

I will have to move log_file_mutex and pattern_rwlock to vlog.h.
Do we want this?
Does it make difference if OVS_REQUIRES is only used in C file
but not in header file?

Thanks,
William


More information about the dev mailing list