Re: [ovs-dev] [PATCH ovn 1/2] Handle re-used pids in pidfile_is_running

2022-06-02 Thread Terry Wilson
On Wed, Jun 1, 2022 at 10:18 PM Ihar Hrachyshka  wrote:
>
> On Wed, Jun 1, 2022 at 1:26 PM Terry Wilson  wrote:
> >
> > Since pids can be re-used, it is necessary to check that the
> > process that is running with a pid matches the one that we expect.
> >
> > This adds the ability to optionally pass a 'binary' argument to
> > pidfile_is_running, and if it is passed to match the binary against
> > /proc/$pid/exe.
> >
> > Signed-off-by: Terry Wilson 
> > ---
> >  ovs   | 2 +-
>
> Why do you bump the submodule in this patch?

Very good question. Not sure how that snuck in. :/

> >  utilities/ovn-ctl | 9 -
> >  2 files changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/ovs b/ovs
> > index d7c0b90fa..91e1ff5dd 16
> > --- a/ovs
> > +++ b/ovs
> > @@ -1 +1 @@
> > -Subproject commit d7c0b90fa360a694f0f3b4f4ce1c514fec4e4359
> > +Subproject commit 91e1ff5dde396fbcc8623ac0726066e970e6de15
> > diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
> > index d733aa42d..41fa89770 100755
> > --- a/utilities/ovn-ctl
> > +++ b/utilities/ovn-ctl
> > @@ -40,9 +40,16 @@ ovn_ic_db_conf_file="$ovn_etcdir/ovn-ic-db-params.conf"
> >  ## start ##
> >  ## - ##
> >
> > +pid_exe_matches () {
> > +pid=$1
> > +binary=$2
> > +[ -z "$binary" -o `readlink /proc/$pid/exe` = "$binary" ]
> > +}
> > +
> >  pidfile_is_running () {
> >  pidfile=$1
> > -test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && 
> > pid_exists "$pid"
> > +binary=$2
> > +test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && 
> > pid_exists "$pid" && pid_exe_matches "$pid" "$binary"
> >  } >/dev/null 2>&1
> >
> >  stop_nb_ovsdb() {
> > --
> > 2.34.3
> >
> > ___
> > dev mailing list
> > d...@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >
>

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH ovn 1/2] Handle re-used pids in pidfile_is_running

2022-06-01 Thread Ihar Hrachyshka
On Wed, Jun 1, 2022 at 1:26 PM Terry Wilson  wrote:
>
> Since pids can be re-used, it is necessary to check that the
> process that is running with a pid matches the one that we expect.
>
> This adds the ability to optionally pass a 'binary' argument to
> pidfile_is_running, and if it is passed to match the binary against
> /proc/$pid/exe.
>
> Signed-off-by: Terry Wilson 
> ---
>  ovs   | 2 +-

Why do you bump the submodule in this patch?

>  utilities/ovn-ctl | 9 -
>  2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/ovs b/ovs
> index d7c0b90fa..91e1ff5dd 16
> --- a/ovs
> +++ b/ovs
> @@ -1 +1 @@
> -Subproject commit d7c0b90fa360a694f0f3b4f4ce1c514fec4e4359
> +Subproject commit 91e1ff5dde396fbcc8623ac0726066e970e6de15
> diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
> index d733aa42d..41fa89770 100755
> --- a/utilities/ovn-ctl
> +++ b/utilities/ovn-ctl
> @@ -40,9 +40,16 @@ ovn_ic_db_conf_file="$ovn_etcdir/ovn-ic-db-params.conf"
>  ## start ##
>  ## - ##
>
> +pid_exe_matches () {
> +pid=$1
> +binary=$2
> +[ -z "$binary" -o `readlink /proc/$pid/exe` = "$binary" ]
> +}
> +
>  pidfile_is_running () {
>  pidfile=$1
> -test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && 
> pid_exists "$pid"
> +binary=$2
> +test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && 
> pid_exists "$pid" && pid_exe_matches "$pid" "$binary"
>  } >/dev/null 2>&1
>
>  stop_nb_ovsdb() {
> --
> 2.34.3
>
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH ovn 1/2] Handle re-used pids in pidfile_is_running

2022-06-01 Thread Terry Wilson
On Wed, Jun 1, 2022 at 1:30 PM 0-day Robot  wrote:
> checkpatch:
> WARNING: Line is 124 characters long (recommended limit is 79)
> #44 FILE: utilities/ovn-ctl:52:
> test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && 
> pid_exists "$pid" && pid_exe_matches "$pid" "$binary"
>
> Lines checked: 50, Warnings: 1, Errors: 0

Since the line was > 79 chars before I got here and there are much
longer lines in this file, I'm going to treat this as a non-issue
unless I hear otherwise.

Terry

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH ovn 1/2] Handle re-used pids in pidfile_is_running

2022-06-01 Thread 0-day Robot
Bleep bloop.  Greetings Terry Wilson, I am a robot and I have tried out your 
patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 124 characters long (recommended limit is 79)
#44 FILE: utilities/ovn-ctl:52:
test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && 
pid_exists "$pid" && pid_exe_matches "$pid" "$binary"

Lines checked: 50, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email 
acon...@redhat.com

Thanks,
0-day Robot
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH ovn 1/2] Handle re-used pids in pidfile_is_running

2022-06-01 Thread Terry Wilson
Since pids can be re-used, it is necessary to check that the
process that is running with a pid matches the one that we expect.

This adds the ability to optionally pass a 'binary' argument to
pidfile_is_running, and if it is passed to match the binary against
/proc/$pid/exe.

Signed-off-by: Terry Wilson 
---
 ovs   | 2 +-
 utilities/ovn-ctl | 9 -
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ovs b/ovs
index d7c0b90fa..91e1ff5dd 16
--- a/ovs
+++ b/ovs
@@ -1 +1 @@
-Subproject commit d7c0b90fa360a694f0f3b4f4ce1c514fec4e4359
+Subproject commit 91e1ff5dde396fbcc8623ac0726066e970e6de15
diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
index d733aa42d..41fa89770 100755
--- a/utilities/ovn-ctl
+++ b/utilities/ovn-ctl
@@ -40,9 +40,16 @@ ovn_ic_db_conf_file="$ovn_etcdir/ovn-ic-db-params.conf"
 ## start ##
 ## - ##
 
+pid_exe_matches () {
+pid=$1
+binary=$2
+[ -z "$binary" -o `readlink /proc/$pid/exe` = "$binary" ]
+}
+
 pidfile_is_running () {
 pidfile=$1
-test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && 
pid_exists "$pid"
+binary=$2
+test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && 
pid_exists "$pid" && pid_exe_matches "$pid" "$binary"
 } >/dev/null 2>&1
 
 stop_nb_ovsdb() {
-- 
2.34.3

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev