Message ID | 20230407065904.865968-1-wanghanlin@corp.netease.com |
---|---|
State | Rejected |
Headers | show |
Series | [ovs-dev] ovsdb-cs: fix 'cs_db' lock flag not updated error. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/intel-ovs-compilation | success | test: success |
On Fri, Apr 07, 2023 at 02:59:04PM +0800, wanghanlin wrote: > When 'cs' is not connected to a server, then > ovsdb_cs_db_compose_lock_request__ will update > 'cs_db' lock flag, but the lock flag will not > be updated next. > > Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Hi, Are there also error conditions where this situation can arise?
在 2023/4/7 21:20, Simon Horman 写道: > On Fri, Apr 07, 2023 at 02:59:04PM +0800, wanghanlin wrote: >> When 'cs' is not connected to a server, then >> ovsdb_cs_db_compose_lock_request__ will update >> 'cs_db' lock flag, but the lock flag will not >> be updated next. >> >> Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> > Hi, > > Are there also error conditions where this situation can arise? This happens when reconnect_disable is called.
On 4/11/23 11:07, 汪翰林 wrote: > > 在 2023/4/7 21:20, Simon Horman 写道: >> On Fri, Apr 07, 2023 at 02:59:04PM +0800, wanghanlin wrote: >>> When 'cs' is not connected to a server, then >>> ovsdb_cs_db_compose_lock_request__ will update >>> 'cs_db' lock flag, but the lock flag will not >>> be updated next. >>> >>> Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> >> Hi, >> >> Are there also error conditions where this situation can arise? > This happens when reconnect_disable is called. Hi. Why exactly this condition is bad? While composing the lock request the 'has_lock' flag will be dropped to 'false'. The lock request will be created, but the send will fail, since there is no connection. However, this shouldn't have any consequences, because we do not claim to have a lock. Once we re-connect a new request should be formed and sent out. Or am I missing something? Best regards, Ilya Maximets.
On 5/4/23 12:12, Ilya Maximets wrote: > On 4/11/23 11:07, 汪翰林 wrote: >> >> 在 2023/4/7 21:20, Simon Horman 写道: >>> On Fri, Apr 07, 2023 at 02:59:04PM +0800, wanghanlin wrote: >>>> When 'cs' is not connected to a server, then >>>> ovsdb_cs_db_compose_lock_request__ will update >>>> 'cs_db' lock flag, but the lock flag will not >>>> be updated next. >>>> >>>> Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> >>> Hi, >>> >>> Are there also error conditions where this situation can arise? >> This happens when reconnect_disable is called. > > Hi. Why exactly this condition is bad? While composing the > lock request the 'has_lock' flag will be dropped to 'false'. > The lock request will be created, but the send will fail, since > there is no connection. However, this shouldn't have any > consequences, because we do not claim to have a lock. Once we > re-connect a new request should be formed and sent out. Or am > I missing something? Even worse, if we do not drop the flag, the application will still think that it has the lock, while it doesn't. > > Best regards, Ilya Maximets.
在 2023/5/4 18:14, Ilya Maximets 写道: > On 5/4/23 12:12, Ilya Maximets wrote: >> On 4/11/23 11:07, 汪翰林 wrote: >>> 在 2023/4/7 21:20, Simon Horman 写道: >>>> On Fri, Apr 07, 2023 at 02:59:04PM +0800, wanghanlin wrote: >>>>> When 'cs' is not connected to a server, then >>>>> ovsdb_cs_db_compose_lock_request__ will update >>>>> 'cs_db' lock flag, but the lock flag will not >>>>> be updated next. >>>>> >>>>> Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> >>>> Hi, >>>> >>>> Are there also error conditions where this situation can arise? >>> This happens when reconnect_disable is called. >> Hi. Why exactly this condition is bad? While composing the >> lock request the 'has_lock' flag will be dropped to 'false'. >> The lock request will be created, but the send will fail, since >> there is no connection. However, this shouldn't have any >> consequences, because we do not claim to have a lock. Once we >> re-connect a new request should be formed and sent out. Or am >> I missing something? > Even worse, if we do not drop the flag, the application will still > think that it has the lock, while it doesn't. > >> Best regards, Ilya Maximets. In bridge_run, ovsdb_idl_has_lock will check the 'has_lock' flag and return immediately when 'has_lock' is false.
在 2023/5/5 10:55, 汪翰林 写道: > > 在 2023/5/4 18:14, Ilya Maximets 写道: >> On 5/4/23 12:12, Ilya Maximets wrote: >>> On 4/11/23 11:07, 汪翰林 wrote: >>>> 在 2023/4/7 21:20, Simon Horman 写道: >>>>> On Fri, Apr 07, 2023 at 02:59:04PM +0800, wanghanlin wrote: >>>>>> When 'cs' is not connected to a server, then >>>>>> ovsdb_cs_db_compose_lock_request__ will update >>>>>> 'cs_db' lock flag, but the lock flag will not >>>>>> be updated next. >>>>>> >>>>>> Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> >>>>> Hi, >>>>> >>>>> Are there also error conditions where this situation can arise? >>>> This happens when reconnect_disable is called. >>> Hi. Why exactly this condition is bad? While composing the >>> lock request the 'has_lock' flag will be dropped to 'false'. >>> The lock request will be created, but the send will fail, since >>> there is no connection. However, this shouldn't have any >>> consequences, because we do not claim to have a lock. Once we >>> re-connect a new request should be formed and sent out. Or am >>> I missing something? >> Even worse, if we do not drop the flag, the application will still >> think that it has the lock, while it doesn't. >> >>> Best regards, Ilya Maximets. > > > In bridge_run, ovsdb_idl_has_lock will check the 'has_lock' flag and > return immediately when 'has_lock' is false. > Because ovs process flow configuration in connmgr_run called by bridge_run__, then flow configure will not work now.
On 5/5/23 05:15, 汪翰林 wrote: > > 在 2023/5/5 10:55, 汪翰林 写道: >> >> 在 2023/5/4 18:14, Ilya Maximets 写道: >>> On 5/4/23 12:12, Ilya Maximets wrote: >>>> On 4/11/23 11:07, 汪翰林 wrote: >>>>> 在 2023/4/7 21:20, Simon Horman 写道: >>>>>> On Fri, Apr 07, 2023 at 02:59:04PM +0800, wanghanlin wrote: >>>>>>> When 'cs' is not connected to a server, then >>>>>>> ovsdb_cs_db_compose_lock_request__ will update >>>>>>> 'cs_db' lock flag, but the lock flag will not >>>>>>> be updated next. >>>>>>> >>>>>>> Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> >>>>>> Hi, >>>>>> >>>>>> Are there also error conditions where this situation can arise? >>>>> This happens when reconnect_disable is called. >>>> Hi. Why exactly this condition is bad? While composing the >>>> lock request the 'has_lock' flag will be dropped to 'false'. >>>> The lock request will be created, but the send will fail, since >>>> there is no connection. However, this shouldn't have any >>>> consequences, because we do not claim to have a lock. Once we >>>> re-connect a new request should be formed and sent out. Or am >>>> I missing something? >>> Even worse, if we do not drop the flag, the application will still >>> think that it has the lock, while it doesn't. >>> >>>> Best regards, Ilya Maximets. >> >> >> In bridge_run, ovsdb_idl_has_lock will check the 'has_lock' flag and return immediately when 'has_lock' is false. That is intended behavior. If we don't have database connection we should not apply any changes. > Because ovs process flow configuration in connmgr_run called by bridge_run__, then flow configure will not work now. We can't validate port numbers if we don't have connection to the database. For example, if the second ovs-vswitchd process is started on the system for some reason, it should not apply any configuration changes to the datapath. This is ensured by the database lock. Best regards, Ilya Maximets.
diff --git a/lib/ovsdb-cs.c b/lib/ovsdb-cs.c index c7c147cc0..f909a66f9 100644 --- a/lib/ovsdb-cs.c +++ b/lib/ovsdb-cs.c @@ -632,7 +632,7 @@ ovsdb_cs_run(struct ovsdb_cs *cs, struct ovs_list *events) ovsdb_cs_db_add_event(&cs->data, OVSDB_CS_EVENT_TYPE_RECONNECT); - if (cs->data.lock_name) { + if (cs->data.lock_name && ovsdb_cs_is_connected(cs)) { jsonrpc_session_send( cs->session, ovsdb_cs_db_compose_lock_request(&cs->data));
When 'cs' is not connected to a server, then ovsdb_cs_db_compose_lock_request__ will update 'cs_db' lock flag, but the lock flag will not be updated next. Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> --- lib/ovsdb-cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)