From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Christoph Hellwig <hch@infradead.org>,
"Nicholas A. Bellinger" <nab@daterainc.com>,
target-devel <target-devel@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Hannes Reinecke <hare@suse.de>,
Sagi Grimberg <sagig@mellanox.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: Re: [PATCH-v2 1/9] target: Convert se_node_acl->device_list[] to RCU hlist
Date: Mon, 25 May 2015 21:11:51 -0700 [thread overview]
Message-ID: <1432613511.26863.10.camel@haakon3.risingtidesystems.com> (raw)
In-Reply-To: <1432592058.722.14.camel@haakon3.risingtidesystems.com>
On Mon, 2015-05-25 at 15:14 -0700, Nicholas A. Bellinger wrote:
> On Fri, 2015-05-22 at 13:31 +0200, Christoph Hellwig wrote:
> > On Fri, May 22, 2015 at 01:55:30AM -0700, Nicholas A. Bellinger wrote:
<SNIP>
> > > > > + kref_put(&orig->pr_kref, target_pr_kref_release);
> > > > > + wait_for_completion(&orig->pr_comp);
> > > > >
> > > >
> > > > > + kref_put(&orig->pr_kref, target_pr_kref_release);
> > > > > /*
> > > > > - * Disable struct se_dev_entry LUN ACL mapping
> > > > > + * Before fireing off RCU callback, wait for any in process SPEC_I_PT=1
> > > > > + * or REGISTER_AND_MOVE PR operation to complete.
> > > > > */
> > > > > + wait_for_completion(&orig->pr_comp);
> > > > > + kfree_rcu(orig, rcu_head);
> > > >
> > > > The release callback should just call kfree_rcu, no need to wait for the
> > > > release in the caller.
> > > >
> > >
> > > Why doesn't se_dev_entry release this need to wait for the special case
> > > references to drop..?
> >
> > Why would it?
>
> It originally had to wait in order for the se_dev_entry consumers to
> drop, before it could be reused in se_node_acl->device_list[]..
>
> > There is no access to the structure at this point, so there
> > is no point to keep it around localy. If there were other references to
> > it they by defintion don't need it anymore by the time they drop the
> > reference count. Freeing a structure as soon as the refcount drops
> > zero is the normal style all over the place. Waiting for a reference
> > count only makes sense if it's a drain style operation where you don't
> > free the structure but you just want to wait for some class of consumers
> > to stop using it.
>
> .. but since it's not being reused anymore, doing a kfree_rcu() from the
> final kref_put() should be fine.
>
> Converting now.
Looking at this more while adding rcu notation, just calling kfree_rcu()
from kref_put() is not going to work here.
The wait_for_completion(&orig->pr_comp) above is still required because
core_scsi3_lunacl_depend_item() has to dereference se_deve->se_lun_acl
outside of the lock (with se_deve->pr_kref held) to obtain the configfs
dependency for se_lun_acl->se_lun_group.
Otherwise, se_lun_acl->se_lun_group can be removed from out below the
core_scsi3_lunacl_depend_item() caller, if se_deve->pr_comp doesn't wait
for the configfs dependency to be released.
--nab
next prev parent reply other threads:[~2015-05-26 4:12 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 6:11 [PATCH-v2 0/9] target: se_node_acl + se_lun RCU conversions Nicholas A. Bellinger
2015-05-22 6:11 ` [PATCH-v2 1/9] target: Convert se_node_acl->device_list[] to RCU hlist Nicholas A. Bellinger
2015-05-22 8:24 ` Christoph Hellwig
2015-05-22 8:55 ` Nicholas A. Bellinger
2015-05-22 11:31 ` Christoph Hellwig
2015-05-25 22:14 ` Nicholas A. Bellinger
2015-05-26 4:11 ` Nicholas A. Bellinger [this message]
2015-05-22 6:11 ` [PATCH-v2 2/9] target/pr: Use atomic bitop for se_dev_entry->pr_reg reservation check Nicholas A. Bellinger
2015-05-22 8:26 ` Christoph Hellwig
2015-05-22 9:05 ` Nicholas A. Bellinger
2015-05-22 11:34 ` Christoph Hellwig
2015-05-25 22:25 ` Nicholas A. Bellinger
2015-05-22 10:12 ` Bart Van Assche
2015-05-25 21:59 ` Nicholas A. Bellinger
2015-05-22 11:52 ` Christoph Hellwig
2015-05-25 22:54 ` Nicholas A. Bellinger
2015-05-22 6:11 ` [PATCH-v2 3/9] target/pr: Change alloc_registration to avoid pr_reg_tg_pt_lun Nicholas A. Bellinger
2015-05-22 6:11 ` [PATCH-v2 4/9] target/pr: cleanup core_scsi3_pr_seq_non_holder Nicholas A. Bellinger
2015-05-22 8:26 ` Christoph Hellwig
2015-05-22 6:11 ` [PATCH-v2 5/9] target: Convert se_portal_group->tpg_lun_list[] to RCU hlist Nicholas A. Bellinger
2015-05-22 8:31 ` Christoph Hellwig
2015-05-22 8:48 ` Nicholas A. Bellinger
2015-05-22 6:11 ` [PATCH-v2 6/9] target: Convert se_tpg->acl_node_lock to ->acl_node_mutex Nicholas A. Bellinger
2015-05-22 6:11 ` [PATCH-v2 7/9] target: Convert core_tpg_deregister to use list splice Nicholas A. Bellinger
2015-05-22 6:11 ` [PATCH-v2 8/9] target: Drop unused se_lun->lun_acl_list Nicholas A. Bellinger
2015-05-22 6:11 ` [PATCH-v2 9/9] target: Only reset specific dynamic entries during lun_group creation Nicholas A. Bellinger
2015-05-22 6:23 ` [PATCH-v2 0/9] target: se_node_acl + se_lun RCU conversions Hannes Reinecke
2015-05-22 8:07 ` Christoph Hellwig
2015-05-22 8:18 ` Nicholas A. Bellinger
2015-05-22 10:15 ` Bart Van Assche
2015-05-25 22:01 ` Nicholas A. Bellinger
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=1432613511.26863.10.camel@haakon3.risingtidesystems.com \
--to=nab@linux-iscsi.org \
--cc=hare@suse.de \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@daterainc.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=sagig@mellanox.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
all inboxes | Powered by JetHome®