Skip to content

Commit

Permalink
scsi: target: iscsi: calling iscsit_stop_session() inside iscsit_clos…
Browse files Browse the repository at this point in the history
…e_session() has no effect

iscsit_close_session() can only be called when nconn is zero (otherwise a
kernel panic is triggered). If nconn is zero then iscsit_stop_session()
does nothing and exits, so calling it makes no sense.

We still need to call iscsit_check_session_usage_count() because this
function will sleep if the session's refcount is not zero and we don't want
to destroy the session structure if it's still being referenced.

Link: https://lore.kernel.org/r/[email protected]
Tested-by: Rahul Kundu <[email protected]>
Signed-off-by: Maurizio Lombardi <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
maurizio-lombardi authored and martinkpetersen committed Mar 27, 2020
1 parent 57c46e9 commit 626bac7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/target/iscsi/iscsi_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -4381,8 +4381,7 @@ int iscsit_close_session(struct iscsi_session *sess)
* restart the timer and exit.
*/
if (!in_interrupt()) {
if (iscsit_check_session_usage_count(sess) == 1)
iscsit_stop_session(sess, 1, 1);
iscsit_check_session_usage_count(sess);
} else {
if (iscsit_check_session_usage_count(sess) == 2) {
atomic_set(&sess->session_logout, 0);
Expand Down

0 comments on commit 626bac7

Please sign in to comment.