From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Hannes Reinecke <hare@suse.de>
Cc: "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>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 2/4] target: Drop lun_sep_lock for se_lun->lun_se_dev RCU usage
Date: Fri, 22 May 2015 01:10:45 -0700 [thread overview]
Message-ID: <1432282245.25585.6.camel@haakon3.risingtidesystems.com> (raw)
In-Reply-To: <555EE165.3090709@suse.de>
On Fri, 2015-05-22 at 09:57 +0200, Hannes Reinecke wrote:
> On 05/22/2015 09:06 AM, Nicholas A. Bellinger wrote:
> > From: Nicholas Bellinger <nab@linux-iscsi.org>
> >
> > With se_port and t10_alua_tg_pt_gp_member being absored into se_lun,
> > there is no need for an extra lock to protect se_lun->lun_se_dev
> > assignment.
> >
> > Also, convert se_lun->lun_stats to use atomic_long_t within the
> > target_complete_ok_work() completion callback.
> >
> > Reported-by: Christoph Hellwig <hch@lst.de>
> > Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
> > ---
> > drivers/target/target_core_device.c | 1 -
> > drivers/target/target_core_stat.c | 65 +++++++++++++++++-----------------
> > drivers/target/target_core_tpg.c | 8 ++---
> > drivers/target/target_core_transport.c | 22 ++++--------
> > include/target/target_core_base.h | 9 +++--
> > 5 files changed, 46 insertions(+), 59 deletions(-)
> >
>
> [ .. ]
>
> > diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
> > index 8764f1c..f60b74e 100644
> > --- a/drivers/target/target_core_tpg.c
> > +++ b/drivers/target/target_core_tpg.c
> > @@ -601,7 +601,6 @@ struct se_lun *core_tpg_alloc_lun(
> > lun->lun_link_magic = SE_LUN_LINK_MAGIC;
> > lun->lun_status = TRANSPORT_LUN_STATUS_FREE;
> > atomic_set(&lun->lun_acl_count, 0);
> > - spin_lock_init(&lun->lun_sep_lock);
> > init_completion(&lun->lun_ref_comp);
> > INIT_LIST_HEAD(&lun->lun_deve_list);
> > INIT_LIST_HEAD(&lun->lun_dev_link);
> > @@ -638,10 +637,7 @@ int core_tpg_add_lun(
> > target_attach_tg_pt_gp(lun, dev->t10_alua.default_tg_pt_gp);
> >
> > mutex_lock(&tpg->tpg_lun_mutex);
> > -
> > - spin_lock(&lun->lun_sep_lock);
> > - lun->lun_se_dev = dev;
> > - spin_unlock(&lun->lun_sep_lock);
> > + rcu_assign_pointer(lun->lun_se_dev, dev);
> >
> > spin_lock(&dev->se_port_lock);
> > dev->export_count++;
> > @@ -683,7 +679,7 @@ void core_tpg_remove_lun(
> > dev->export_count--;
> > spin_unlock(&dev->se_port_lock);
> >
> > - lun->lun_se_dev = NULL;
> > + rcu_assign_pointer(lun->lun_se_dev, NULL);
> > }
> >
> > lun->lun_status = TRANSPORT_LUN_STATUS_FREE;
> Doesn't this need to go under 'dev->se_port_lock' like in
> core_tgp_add_lun() ?
Yes, of course. Adding the following change, and will squash into the
original patch soon.
Thanks for reviewing Hannes!
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
index aa08d6b..a3c9121 100644
--- a/drivers/target/target_core_tpg.c
+++ b/drivers/target/target_core_tpg.c
@@ -641,9 +641,9 @@ int core_tpg_add_lun(
target_attach_tg_pt_gp(lun, dev->t10_alua.default_tg_pt_gp);
mutex_lock(&tpg->tpg_lun_mutex);
- rcu_assign_pointer(lun->lun_se_dev, dev);
spin_lock(&dev->se_port_lock);
+ rcu_assign_pointer(lun->lun_se_dev, dev);
dev->export_count++;
list_add_tail(&lun->lun_dev_link, &dev->dev_sep_list);
spin_unlock(&dev->se_port_lock);
next prev parent reply other threads:[~2015-05-22 8:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 7:06 [PATCH 0/4] target: Eliminate se_port + t10_alua_tg_pt_gp_member Nicholas A. Bellinger
2015-05-22 7:06 ` [PATCH 1/4] target: Subsume se_port + t10_alua_tg_pt_gp_member into se_lun Nicholas A. Bellinger
2015-05-22 7:58 ` Hannes Reinecke
2015-05-22 7:06 ` [PATCH 2/4] target: Drop lun_sep_lock for se_lun->lun_se_dev RCU usage Nicholas A. Bellinger
2015-05-22 7:57 ` Hannes Reinecke
2015-05-22 8:10 ` Nicholas A. Bellinger [this message]
2015-05-22 11:56 ` Christoph Hellwig
2015-05-25 22:59 ` Nicholas A. Bellinger
2015-05-22 7:06 ` [PATCH 3/4] target: Drop se_lun->lun_active for existing percpu lun_ref Nicholas A. Bellinger
2015-05-22 7:58 ` Hannes Reinecke
2015-05-22 7:58 ` Hannes Reinecke
2015-05-22 7:06 ` [PATCH 4/4] target: Drop unnecessary core_tpg_register TFO parameter Nicholas A. Bellinger
2015-05-22 8:00 ` Hannes Reinecke
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=1432282245.25585.6.camel@haakon3.risingtidesystems.com \
--to=nab@linux-iscsi.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@daterainc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.