From patchwork Thu Jun 11 08:01:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 6586351 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4294BC0020 for ; Thu, 11 Jun 2015 08:01:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6DB272060E for ; Thu, 11 Jun 2015 08:01:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA6602063D for ; Thu, 11 Jun 2015 08:01:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752540AbbFKIBo (ORCPT ); Thu, 11 Jun 2015 04:01:44 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52723 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752465AbbFKIBf (ORCPT ); Thu, 11 Jun 2015 04:01:35 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AD78DAD5E; Thu, 11 Jun 2015 08:01:32 +0000 (UTC) From: Hannes Reinecke To: Nic Bellinger Cc: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, Christoph Hellwig , Hannes Reinecke Subject: [PATCH 5/6] target: Send UA upon LUN RESET tmr completion Date: Thu, 11 Jun 2015 10:01:28 +0200 Message-Id: <1434009689-112909-6-git-send-email-hare@suse.de> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1434009689-112909-1-git-send-email-hare@suse.de> References: <1434009689-112909-1-git-send-email-hare@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP SAM mandates that an BUS DEVICE RESET FUNCTION OCCURRED UA needs to be send after a LUN RESET tmr has completed. Signed-off-by: Hannes Reinecke --- drivers/target/target_core_transport.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index a0e0d3a..bb60c0c4 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -3064,6 +3064,17 @@ static void target_tmr_work(struct work_struct *work) ret = core_tmr_lun_reset(dev, tmr, NULL, NULL); tmr->response = (!ret) ? TMR_FUNCTION_COMPLETE : TMR_FUNCTION_REJECTED; + if (tmr->response == TMR_FUNCTION_COMPLETE) { + struct se_dev_entry *deve; + + rcu_read_lock(); + deve = target_nacl_find_deve(cmd->se_sess->se_node_acl, + cmd->orig_fe_lun); + if (deve) + core_scsi3_ua_allocate(deve, 0x29, + ASCQ_29H_BUS_DEVICE_RESET_FUNCTION_OCCURRED); + rcu_read_unlock(); + } break; case TMR_TARGET_WARM_RESET: tmr->response = TMR_FUNCTION_REJECTED;