Target-devel archive mirror
 help / color / mirror / Atom feed
From: Mike Christie <michael.christie@oracle.com>
To: Maurizio Lombardi <mlombard@redhat.com>, martin.petersen@oracle.com
Cc: target-devel@vger.kernel.org
Subject: Re: [PATCH V2 3/3] target: iscsi: prevent login threads from racing between each other
Date: Wed, 26 Apr 2023 10:44:27 -0500	[thread overview]
Message-ID: <792bbf44-f88d-7919-b7ce-09e30f9f347f@oracle.com> (raw)
In-Reply-To: <20230417171801.208122-4-mlombard@redhat.com>

On 4/17/23 12:18 PM, Maurizio Lombardi wrote:
> The tpg->np_login_sem is a semaphore that is used to serialize the login
> process when multiple login threads run concurrently against the same
> target portal group.
> 
> The iscsi_target_locate_portal() function finds the tpg,
> calls iscsit_access_np() against the np_login_sem semaphore
> and saves the tpg pointer in conn->tpg;
> 
> If iscsi_target_locate_portal() fails, the caller will check for the
> conn->tpg pointer and, if it's not NULL, then it will assume
> that iscsi_target_locate_portal() called iscsit_access_np() on the
> semaphore.
> 
> Make sure that conn->tpg gets initialized only if iscsit_access_np()
> was successful, otherwise iscsit_deaccess_np() may end up
> being called against a semaphore we never took, allowing more than one
> thread to access the same tpg.
> 
> Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>

Reviewed-by: Mike Christie <michael.christie@oracle.com>


      reply	other threads:[~2023-04-26 15:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17 17:17 [PATCH V2 0/3] Fix possible hangs and race conditions during login Maurizio Lombardi
2023-04-17 17:17 ` [PATCH V2 1/3] target: iscsi: fix hang in the iSCSI login code Maurizio Lombardi
2023-04-26 15:35   ` Mike Christie
2023-04-26 15:39     ` Mike Christie
2023-04-17 17:18 ` [PATCH V2 2/3] target: iscsi: remove unused transport_timer Maurizio Lombardi
2023-04-26 15:43   ` Mike Christie
2023-04-17 17:18 ` [PATCH V2 3/3] target: iscsi: prevent login threads from racing between each other Maurizio Lombardi
2023-04-26 15:44   ` Mike Christie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=792bbf44-f88d-7919-b7ce-09e30f9f347f@oracle.com \
    --to=michael.christie@oracle.com \
    --cc=martin.petersen@oracle.com \
    --cc=mlombard@redhat.com \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).