From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756042AbcAMIYk (ORCPT ); Wed, 13 Jan 2016 03:24:40 -0500 Received: from verein.lst.de ([213.95.11.211]:41608 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753151AbcAMIYi (ORCPT ); Wed, 13 Jan 2016 03:24:38 -0500 Date: Wed, 13 Jan 2016 09:24:36 +0100 From: Christoph Hellwig To: "Nicholas A. Bellinger" Cc: Christoph Hellwig , "Nicholas A. Bellinger" , target-devel , linux-scsi , lkml , Sagi Grimberg , Hannes Reinecke , Andy Grover , Vasu Dev , Vu Pham Subject: Re: [PATCH-v2 3/4] target: Fix change depth se_session reference usage Message-ID: <20160113082436.GA13113@lst.de> References: <1452457724-10629-1-git-send-email-nab@daterainc.com> <1452457724-10629-4-git-send-email-nab@daterainc.com> <20160112150707.GB2058@lst.de> <1452670172.27508.32.camel@haakon3.risingtidesystems.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1452670172.27508.32.camel@haakon3.risingtidesystems.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 12, 2016 at 11:29:32PM -0800, Nicholas A. Bellinger wrote: > With this patch in place, this function is now also called by > core_tpg_set_initiator_node_queue_depth(), where previously it was > called only during target_alloc_node_acl(). > > Might as well drop the ignored return while we're at it.. Please add it to the patch description.. > > > + continue; > > > + } > > > + target_put_session(sess); > > > + spin_lock_irqsave(&acl->nacl_sess_lock, flags); > > > } > > > + spin_unlock_irqrestore(&acl->nacl_sess_lock, flags); > > > > It seems at thus point there is no need for ->shutdown_session, it > > could be folded into ->close_session in a follow on patch. > > > > Not exactly. > > It's the final target_put_session() -> kref_put() upon > se_sess->sess_kref that invokes TFO->close_session(). I know. But we are dropping the only long term held reference here, so the two are more or less equivalent. > > > -void target_get_session(struct se_session *se_sess) > > > +int target_get_session(struct se_session *se_sess) > > > { > > > - kref_get(&se_sess->sess_kref); > > > + return kref_get_unless_zero(&se_sess->sess_kref); > > > } > > > EXPORT_SYMBOL(target_get_session); > > > > I'd be much happier to have a separate prep patch for this.. > > Since this will need to hit stable at some point, it likely needs to > stay with the original bug-fix. Please at least document it in the patch description. I'd still be happier to have the change to target_get_session as a preparatory patch, though.