tools/xenstored: liveupdate: Properly check long transaction
authorJulien Grall <jgrall@amazon.com>
Wed, 3 Mar 2021 17:05:26 +0000 (17:05 +0000)
committerJulien Grall <jgrall@amazon.com>
Thu, 4 Mar 2021 15:36:24 +0000 (15:36 +0000)
commit5d16679ab0760dbe5e4df52c02f15c69ed5541e6
tree3d6349f08652108d147ef78e20cd5af0d9ee7fc3
parent243036df0d55673de59c214e240b9b914d278b65
tools/xenstored: liveupdate: Properly check long transaction

As XenStored is single-threaded, conn->ta_start_time will always be
smaller than now. As we substract the latter from the former, it means
a transaction will never be considered long running.

Invert the two operands of the substraction in both lu_reject_reason()
and lu_check_allowed(). In addition to that, the former also needs to
check that conn->ta_start_time is not 0 (i.e the transaction is not
active).

Take the opportunity to document the return condition of
lu_check_allowed().

Fixes: e04e53a5be20 ("tools/xenstore: allow live update only with no transaction active")
Reported-by: Bjoern Doebel <doebel@amazon.de>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
tools/xenstore/xenstored_control.c