Re: [PATCH V2] target: iscsi: simplify the connection closing mechanism

From
Maurizio Lombardi <hidden>
Date
2021-12-09 10:26:02
Also in
target-devel
Reply to
Mike Christie, 2021-12-07
On Tue, Dec 07, 2021 at 01:59:08PM -0600, Mike Christie wrote:
On 11/11/21 7:37 AM, Maurizio Lombardi wrote:
quoted
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?
At first I thought that setting it to 1 could introduce a race condition,
then I realized that it's not the case, setting it to 1 simply has no effect
and therefore the assignment can be removed.

Maurizio
Thread (3 messages) 3 messages, 2 authors, last reply 2021-12-09
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help