From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH 2/2] target: Fix LUN_RESET active TMR descriptor handling Date: Tue, 12 Jan 2016 16:25:13 +0100 Message-ID: <20160112152513.GC2294@lst.de> References: <1452594245-921-1-git-send-email-nab@daterainc.com> <1452594245-921-3-git-send-email-nab@daterainc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from verein.lst.de ([213.95.11.211]:38553 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965427AbcALPZO (ORCPT ); Tue, 12 Jan 2016 10:25:14 -0500 Content-Disposition: inline In-Reply-To: <1452594245-921-3-git-send-email-nab@daterainc.com> Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: "Nicholas A. Bellinger" Cc: target-devel , linux-scsi , Quinn Tran , Himanshu Madhani , Sagi Grimberg , Christoph Hellwig , Hannes Reinecke , Andy Grover , Nicholas Bellinger > if (dev) { > spin_lock_irqsave(&dev->se_tmr_lock, flags); > - list_del(&tmr->tmr_list); > + if (!list_empty(&tmr->tmr_list)) > + list_del_init(&tmr->tmr_list); list_del_init on a empty list is fine. > + sess = cmd->se_sess; > + if (!sess) { > + dump_stack(); > + continue; > + } Why not something like: if (WARN_ON_ONCE(!sess)) continue; same for the previous patch. > + spin_lock(&sess->sess_cmd_lock); > + rc = kref_get_unless_zero(&cmd->cmd_kref); > + spin_unlock(&sess->sess_cmd_lock); no need to take a lock around kref_get_unless_zero, it's not going to help with anything.