On 11/11/21 7:37 AM, Maurizio Lombardi wrote: > When the connection reinstatement is performed, the target driver > executes a complex scheme of complete()/wait_for_completion() that is not > really needed. > > Considering that: > > 1) The callers of iscsit_connection_reinstatement_rcfr() and > iscsit_cause_connection_reinstatement() hold a reference > to the conn structure.> > 2) iscsit_close_connection() will sleep when calling > iscsit_check_conn_usage_count() until the conn structure's refcount > reaches zero. > > we can optimize the driver the following way: > > * The threads that must sleep until the connection is closed > will all wait for the "conn_wait_comp" completion, > iscsit_close_connection() will then call complete_all() to wake them up. > No need to have multiple completion structures. > > * The conn_post_wait_comp completion is not necessary and can be removed > because iscsit_close_connection() sleeps until all the other threads > release the conn structure. > (see the iscsit_check_conn_usage_count() function) > > V2: do not set connection_reinstatement to 1 in iscsit_close_connection(), > leave iscsit_cause_connection_reinstatement() deal with reentrancy. > What was the issue with setting it to 1?