Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1783013imm; Wed, 10 Oct 2018 22:58:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV6257JU24yjdOav1ZXh3wdDd7t/VdQMfXarDntvVUV/W0sjT4dxWmR+IoS3I78vDfwNMzBjn X-Received: by 2002:a63:9f0a:: with SMTP id g10-v6mr180466pge.232.1539237481835; Wed, 10 Oct 2018 22:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539237481; cv=none; d=google.com; s=arc-20160816; b=iLdxQRWvMMGndD05gc7n8ptk6BkQCBwSZog86ZtG0SD331SkfEglsXLwzIXR+yJPNw lAOKoanDIRXmTMDcP27nXdcEAXl11eRMunqtvcmrPOyTqC1LTBz9cDy+TmYnsdT/iTwQ q1eO5X5/ZfWdlRomdZ7mpeThNKAhDlX1kTu8BgTJgq/gBA7RAtIMnCcMOM3Fv7FUEAoJ BMULpzuS5jaiB+GKpZX/ttZ+OQutdp3tfqPYKW4Ap07LGSg/Gn6mZEMacymHVvtwTPUk mceSHHEuWlQfefHHTQZ6c2MR19lI3+If0rtLTWmrFXTx19WYYewZmlSqN3rvGTvAcgn9 /cTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=eF9Pm63uQ7ripiRKfK6PvU9+naL+t3nCDCRNlgp8nuk=; b=S5SMa8zrNCwp4wr1/DMfYIDcc/lKcCla5+cpalx+Cpjqwr74450iOWgaEAUDXYScal tCaI0sx2XqON/F/ho87bbYZkXMRV5zn3Pguer2ng4jBykGpR2GWYdgjJSvll43MPrewq eoGpU3klnbB2w2jxE5opbxEJn8xCSJRBi8VqSEpuXPlALX7+wSzrKniEZh0TmHISpLUY vklhJ9gpU13bdPLszu4vG8EFfY+5ZCEK3DcRQnkoUfnfKchy6ngma5iFay3SmJC/NdZB 46UJeLAlX03/QA0TDWEN/3p0pL3hgt2zjEMxLGprGHHli09Z8sbsnU7bnRxAxAktRymB Bs1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linux-iscsi.org header.s=default.private header.b=ipWBL3Mq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a15-v6si27075923pfn.248.2018.10.10.22.57.46; Wed, 10 Oct 2018 22:58:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@linux-iscsi.org header.s=default.private header.b=ipWBL3Mq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728112AbeJKNVt (ORCPT + 99 others); Thu, 11 Oct 2018 09:21:49 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:45342 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727065AbeJKNVt (ORCPT ); Thu, 11 Oct 2018 09:21:49 -0400 Received: from [192.168.1.66] (75-37-194-224.lightspeed.lsatca.sbcglobal.net [75.37.194.224]) (using SSLv3 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: nab) by linux-iscsi.org (Postfix) with ESMTPSA id AB32C40ABD; Thu, 11 Oct 2018 05:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=linux-iscsi.org; s=default.private; t=1539237375; bh=AGzWeC5o5upQ7SeKXw97j9lLWY0ir6V NZZKIqtm+e3o=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To: References:Content-Type:Mime-Version:Content-Transfer-Encoding; b=ipWBL3MqMxtGoSUwwToaSzRN/pTJawcURp0ukQ5jZ1Tqme2iMzDJtKT3jczf0lQhT kqRFs3WcDdcXlzl2pS4qXbCcyDBiYet0EHiu47yB4J1IJmnpVp0EruW2yaM0Lyh1cbc AndDbJ59TJCpyEmiEX+Sz5R0EylIBSOIxjY91+Y= Message-ID: <1539237365.6150.32.camel@haakon3.daterainc.com> Subject: Re: [PATCH 2/2] target: Fix target_wait_for_sess_cmds breakage with active signals From: "Nicholas A. Bellinger" To: Mike Christie Cc: "Ly, Bryant" , target-devel , linux-scsi , lkml , "Martin K. Petersen" , Hannes Reinecke , Christoph Hellwig , Sagi Grimberg , "Peter Zijlstra (Intel)" , Bart Van Assche , bly@catalogicsoftware.com Date: Wed, 10 Oct 2018 22:56:05 -0700 In-Reply-To: <5BBE2FBF.7080804@redhat.com> References: <1539141790-13557-1-git-send-email-nab@linux-iscsi.org> <1539141790-13557-3-git-send-email-nab@linux-iscsi.org> <5BBE2FBF.7080804@redhat.com> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.4.4-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello MNC & Co, On Wed, 2018-10-10 at 11:58 -0500, Mike Christie wrote: > On 10/09/2018 10:23 PM, Nicholas A. Bellinger wrote: > > From: Nicholas Bellinger > > > > With the addition of commit 00d909a107 in v4.19-rc, it incorrectly assumes no > > signals will be pending for task_struct executing the normal session shutdown > > and I/O quiesce code-path. > > > > diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c > > index 86c0156..fc3093d2 100644 > > --- a/drivers/target/target_core_transport.c > > +++ b/drivers/target/target_core_transport.c > > @@ -2754,7 +2754,7 @@ static void target_release_cmd_kref(struct kref *kref) > > if (se_sess) { > > spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); > > list_del_init(&se_cmd->se_cmd_list); > > - if (list_empty(&se_sess->sess_cmd_list)) > > + if (se_sess->sess_tearing_down && list_empty(&se_sess->sess_cmd_list)) > > I think there is another issue with 00d909a107 and ibmvscsi_tgt. > > The problem is that ibmvscsi_tgt never called > target_sess_cmd_list_set_waiting. It only called > target_wait_for_sess_cmds. So before 00d909a107 there was a bug in that > driver and target_wait_for_sess_cmds never did what was intended because > sess_wait_list would always be empty. > > With 00d909a107, we no longer need to call > target_sess_cmd_list_set_waiting to wait for outstanding commands, so > for ibmvscsi_tgt will now wait for commands like we wanted. However, the > commit added a WARN_ON that is hit if target_sess_cmd_list_set_waiting > is not called, so we could hit that. > > So I think we need to add a target_sess_cmd_list_set_waiting call in > ibmvscsi_tgt to go along with your patch chunk above and make sure we do > not trigger the WARN_ON. > Nice catch. :) With target_wait_for_sess_cmd() usage pre 00d909a107 doing a list-splice in target_sess_cmd_list_set_waiting(), this particular usage in ibmvscsi_tgt has always been list_empty(&sess->sess_wait_list) = true (eg: no se_cmd I/O is quiesced, because no se_cmd in sess_wait_list) since commit 712db3eb in 4.9.y code. That said, ibmvscsi_tgt usage is very similar to vhost/scsi in the respect individual /sys/kernel/config/target/$FABRIC/$WWN/$TPGT/ endpoints used by VMs do not remove their I_T nexus while the VM is active. So AFAICT, ibmvscsi_tgt doesn't strictly need target_sess_wait_for_cmd() at all if this is true.