Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756772AbbEVH53 (ORCPT ); Fri, 22 May 2015 03:57:29 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45834 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755929AbbEVH51 (ORCPT ); Fri, 22 May 2015 03:57:27 -0400 Message-ID: <555EE165.3090709@suse.de> Date: Fri, 22 May 2015 09:57:25 +0200 From: Hannes Reinecke User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: "Nicholas A. Bellinger" , target-devel CC: linux-scsi , linux-kernel , Christoph Hellwig , Nicholas Bellinger Subject: Re: [PATCH 2/4] target: Drop lun_sep_lock for se_lun->lun_se_dev RCU usage References: <1432278417-29994-1-git-send-email-nab@daterainc.com> <1432278417-29994-3-git-send-email-nab@daterainc.com> In-Reply-To: <1432278417-29994-3-git-send-email-nab@daterainc.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2601 Lines: 73 On 05/22/2015 09:06 AM, Nicholas A. Bellinger wrote: > From: Nicholas Bellinger > > 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 > Signed-off-by: Nicholas Bellinger > --- > 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() ? Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage hare@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: F. Imend?rffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG N?rnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/