SCSI target development
 help / color / mirror / Atom feed
From: Mike Christie <mchristi@redhat.com>
To: Bart Van Assche <bvanassche@acm.org>,
	jsmart2021@gmail.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	nab@linux-iscsi.org
Subject: Re: [RFC PATCH 2/5] target: add sysfs session helper functions
Date: Wed, 15 Apr 2020 17:46:33 +0000	[thread overview]
Message-ID: <5E974879.5000407@redhat.com> (raw)
In-Reply-To: <5E9745DD.2060009@redhat.com>

On 04/15/2020 12:35 PM, Mike Christie wrote:
> On 04/14/2020 09:30 PM, Bart Van Assche wrote:
>> On 2020-04-13 22:15, Mike Christie wrote:
>>> @@ -537,8 +538,15 @@ void transport_deregister_session_configfs(struct se_session *se_sess)
>>>  }
>>>  EXPORT_SYMBOL(transport_deregister_session_configfs);
>>>  
>>> +
>>
>> A single blank line is probably sufficient here?
>>
> 
> Yes. That was a cut and paste mistake when I was separating the code
> into patches. Will fix.
> 
> 
>>>  void transport_free_session(struct se_session *se_sess)
>>>  {
>>> +	kobject_put(&se_sess->kobj);
>>> +}
>>> +EXPORT_SYMBOL(transport_free_session);
>>> +
>>> +void __target_free_session(struct se_session *se_sess)
>>> +{
>>>  	struct se_node_acl *se_nacl = se_sess->se_node_acl;
>>>  
>>>  	/*
>>> @@ -582,7 +590,6 @@ void transport_free_session(struct se_session *se_sess)
>>>  	percpu_ref_exit(&se_sess->cmd_count);
>>>  	kmem_cache_free(se_sess_cache, se_sess);
>>>  }
>>> -EXPORT_SYMBOL(transport_free_session);
>>
>> Does this patch defer execution of the code inside
>> transport_free_session() from when transport_free_session() is called to
>> when the last reference to a session is dropped? Can that have
> 
> Yes.
> 
>> unintended side effects? How about keeping most of the code that occurs
> 
> Yes. For example, we drop the refcount on the ACL in
> __target_free_session so that is now not done until the last session
> rerfcount is done. I did this because we reference the acl in a sysfs file.
> 
> 
>> in transport_free_session() in that function and only freeing the memory
>> associated with the session if the last reference is dropped?
>>
> 
> I tried to minimize it already.
> 
> That is why I have the new session->fabric_free_cb in the next patch.
> That way we do not need refcounts on structs like the tpg and can detach
> that like normal in
> transport_deregister_session/transport_deregister_session_configfs.
> 

Oh yeah, James and Bart, while investigating Bart's comment I noticed
there is a bug where in the session->fabric_free_cb the fabric module
needs the fabric_sess_ptr but that will already have been cleared in
transport_deregister_session.

So James, you will hit a bug in there if you try to adapt elx to these
patches right now.

I will resend with that fixed and Bart's comments handled.

  reply	other threads:[~2020-04-15 17:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14  5:15 [RFC PATCH 0/5] target: add sysfs support Mike Christie
2020-04-14  5:15 ` [RFC PATCH 1/5] " Mike Christie
2020-04-15  2:23   ` Bart Van Assche
2020-04-15 17:28     ` Mike Christie
2020-04-14  5:15 ` [RFC PATCH 2/5] target: add sysfs session helper functions Mike Christie
2020-04-15  2:30   ` Bart Van Assche
2020-04-15 17:35     ` Mike Christie
2020-04-15 17:46       ` Mike Christie [this message]
2020-04-20 17:39   ` Bodo Stroesser
2020-04-20 17:43     ` Mike Christie
2020-04-14  5:15 ` [RFC PATCH 3/5] target: add target_setup_session sysfs support Mike Christie
2020-04-14  5:28   ` Mike Christie
2020-04-15  2:37   ` Bart Van Assche
2020-04-15 17:38     ` Mike Christie
2020-04-14  5:15 ` [RFC PATCH 4/5] iscsi target: use session sysfs helpers Mike Christie
2020-04-14  5:15 ` [RFC PATCH 5/5] target: drop sess_get_index Mike Christie

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=5E974879.5000407@redhat.com \
    --to=mchristi@redhat.com \
    --cc=bvanassche@acm.org \
    --cc=jsmart2021@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nab@linux-iscsi.org \
    --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