From patchwork Fri Jun 15 18:23:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Lingshan X-Patchwork-Id: 10467343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5EA3460384 for ; Fri, 15 Jun 2018 18:25:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F77E28E3B for ; Fri, 15 Jun 2018 18:25:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43E1F28E40; Fri, 15 Jun 2018 18:25:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E597A28E41 for ; Fri, 15 Jun 2018 18:25:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756436AbeFOSZr (ORCPT ); Fri, 15 Jun 2018 14:25:47 -0400 Received: from smtp2.provo.novell.com ([137.65.250.81]:50533 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756418AbeFOSZp (ORCPT ); Fri, 15 Jun 2018 14:25:45 -0400 Received: from vstart.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Fri, 15 Jun 2018 12:25:39 -0600 From: Zhu Lingshan To: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, nab@linux-iscsi.org, mchristi@redhat.com, martin.petersen@oracle.com Cc: hare@suse.de, lduncan@suse.com, ddiss@suse.de, lszhu@suse.de, Zhu Lingshan Subject: [PATCH 33/33] TCMU PR: enable PRO Clear for TCMU devices Date: Sat, 16 Jun 2018 02:23:42 +0800 Message-Id: <20180615182342.6239-33-lszhu@suse.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180615182342.6239-1-lszhu@suse.com> References: <20180615182342.6239-1-lszhu@suse.com> Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch would enable the passthrough Persist Reservation clear operation routine for TCMU devices. If dev->passthrough_pr is 1, both dev->transport->pr_ops and dev->transport->pr_ops->pr_clear are not NULL, core_scsi3_emulate_pro_clear() will call dev->transport->pr_ops->pr_clear to passthrough PR clear request to user space Signed-off-by: Zhu Lingshan --- drivers/target/target_core_pr.c | 5 +++++ drivers/target/target_core_user.c | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index c668dfb84bf1..66bb52ab0209 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -2719,6 +2719,11 @@ core_scsi3_emulate_pro_clear(struct se_cmd *cmd, u64 res_key) struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder; u64 pr_res_mapped_lun = 0; int calling_it_nexus = 0; + + if (dev->transport->pr_ops && dev->transport->pr_ops->pr_read_keys + && dev->passthrough_pr) + return dev->transport->pr_ops->pr_clear(cmd, res_key); + /* * Locate the existing *pr_reg via struct se_node_acl pointers */ diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index c8d0ea330984..c417021f7099 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -4115,6 +4115,7 @@ static struct target_pr_ops tcmu_pr_ops = { .pr_register = tcmu_execute_pr_register, .pr_reserve = tcmu_execute_pr_reserve, .pr_release = tcmu_execute_pr_release, + .pr_clear = tcmu_execute_pr_clear, }; static struct target_backend_ops tcmu_ops = {