SCSI target development
 help / color / mirror / Atom feed
From: Mike Christie <mchristi@redhat.com>
To: target-devel@vger.kernel.org
Subject: Re: [PATCH] target:alua: fix the tg_pt_gps_count
Date: Wed, 20 Mar 2019 16:50:58 +0000	[thread overview]
Message-ID: <5C926F72.3010100@redhat.com> (raw)
In-Reply-To: <1552486046-1360-1-git-send-email-hndksztwj@163.com>

On 03/13/2019 09:07 AM, tangwenji wrote:
> From: tangwenji <tang.wenji@zte.com.cn>
> 
> Reducing the count should be alua_tg_pt_gps_count instead of alua_tg_pt_gps_counter when free alua group.
> 
> Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
> ---
>  drivers/target/target_core_alua.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
> index e09f0cf..4808654 100644
> --- a/drivers/target/target_core_alua.c
> +++ b/drivers/target/target_core_alua.c
> @@ -1761,7 +1761,7 @@ void core_alua_free_tg_pt_gp(
>  	 */
>  	spin_lock(&dev->t10_alua.tg_pt_gps_lock);
>  	list_del(&tg_pt_gp->tg_pt_gp_list);
> -	dev->t10_alua.alua_tg_pt_gps_counter--;
> +	dev->t10_alua.alua_tg_pt_gps_count--;
>  	spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
>  

I think because its always decremented here we could end up going
negative. If userspace does not call into
target_tg_pt_gp_tg_pt_gp_id_store or it fails, then we will not have
done a count++ and not added it to the list in core_alua_set_tg_pt_gp_id.

I think above above we need to do:

if (tg_pt_gp_valid_id) {
    list_del(&tg_pt_gp->tg_pt_gp_list)
    dev->t10_alua.alua_tg_pt_gps_count--;
}

      reply	other threads:[~2019-03-20 16:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 14:07 [PATCH] target:alua: fix the tg_pt_gps_count tangwenji
2019-03-20 16:50 ` 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=5C926F72.3010100@redhat.com \
    --to=mchristi@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