Whamcloud - gitweb
LU-13986 target: fix possible liveloop in distribute_txn thd 43/40043/3
authorMr NeilBrown <neilb@suse.de>
Fri, 25 Sep 2020 05:02:42 +0000 (15:02 +1000)
committerOleg Drokin <green@whamcloud.com>
Mon, 12 Oct 2020 05:47:58 +0000 (05:47 +0000)
A recent patch to update_trans.c changed how distribute_txn_thread()
waited for more work to do.

It previously had an explicit "wait_event()" which listed all the
conditions to wait for.  It would then recheck each condition and
possibly perform an appropriate action.

It was changed to check each condition only once (per loop).  If the
condition was true, the action would be performed and a flag set.  If
no conditions were true (indicated by flag), it would wait, otherwise
it would loop and recheck all condition.

One of the "if (condition) { do work }" stanzas in the loop tested a
condition that was *not* a condition that should wake up the loop.
"batchid" was not tested at all in the wait_event().  The flag
mentioned above was, however, set when that condition tested true.
This can cause the loop to spin indefinitely.

So remove the "__set_current_state(TASK_RUNNING);" so that the value
of batchid cannot stop the loop from sleeping (calling 'schedule()').

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I124ee3e8250dc63fa927f72dc4d29ed3e7b53005
Reviewed-on: https://review.whamcloud.com/40043
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>

No differences found