From patchwork Thu Aug 2 16:13:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10553949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56FF413BB for ; Thu, 2 Aug 2018 16:14:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 474112C2CA for ; Thu, 2 Aug 2018 16:14:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BB0D2C30A; Thu, 2 Aug 2018 16:14:49 +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,UNPARSEABLE_RELAY 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 BE4E52C2CA for ; Thu, 2 Aug 2018 16:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727067AbeHBSGg (ORCPT ); Thu, 2 Aug 2018 14:06:36 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:48835 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726636AbeHBSGf (ORCPT ); Thu, 2 Aug 2018 14:06:35 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Aug 2018 19:18:07 +0300 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w72GEgCq029988; Thu, 2 Aug 2018 19:14:42 +0300 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id w72GEYdM019414; Thu, 2 Aug 2018 19:14:42 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id w72GEYuF019413; Thu, 2 Aug 2018 19:14:34 +0300 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, jgg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 6/6] Consider EIO upon ioctl destroy commands Date: Thu, 2 Aug 2018 19:13:36 +0300 Message-Id: <1533226416-19122-7-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1533226416-19122-1-git-send-email-yishaih@mellanox.com> References: <1533226416-19122-1-git-send-email-yishaih@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use verbs_is_destroy_err() upon ioctl destroy commands to consider the EIO use case. Signed-off-by: Yishai Hadas --- libibverbs/cmd_counters.c | 8 +++++++- libibverbs/cmd_dm.c | 7 ++++++- libibverbs/cmd_flow_action.c | 8 +++++++- libibverbs/libibverbs.map.in | 1 + providers/mlx5/verbs.c | 2 ++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/libibverbs/cmd_counters.c b/libibverbs/cmd_counters.c index 13e66d5..ed57f25 100644 --- a/libibverbs/cmd_counters.c +++ b/libibverbs/cmd_counters.c @@ -33,6 +33,7 @@ #include #include #include +#include int ibv_cmd_create_counters(struct ibv_context *context, struct ibv_counters_init_attr *init_attr, @@ -65,9 +66,14 @@ int ibv_cmd_destroy_counters(struct verbs_counters *vcounters) DECLARE_COMMAND_BUFFER(cmd, UVERBS_OBJECT_COUNTERS, UVERBS_METHOD_COUNTERS_DESTROY, 1); + int ret; fill_attr_in_obj(cmd, UVERBS_ATTR_DESTROY_COUNTERS_HANDLE, vcounters->handle); - return execute_ioctl(vcounters->counters.context, cmd); + ret = execute_ioctl(vcounters->counters.context, cmd); + if (verbs_is_destroy_err(&ret)) + return ret; + + return 0; } int ibv_cmd_read_counters(struct verbs_counters *vcounters, diff --git a/libibverbs/cmd_dm.c b/libibverbs/cmd_dm.c index e2018c3..86b1331 100644 --- a/libibverbs/cmd_dm.c +++ b/libibverbs/cmd_dm.c @@ -62,10 +62,15 @@ int ibv_cmd_free_dm(struct verbs_dm *dm) { DECLARE_COMMAND_BUFFER(cmdb, UVERBS_OBJECT_DM, UVERBS_METHOD_DM_FREE, 1); + int ret; fill_attr_in_obj(cmdb, UVERBS_ATTR_FREE_DM_HANDLE, dm->handle); - return execute_ioctl(dm->dm.context, cmdb); + ret = execute_ioctl(dm->dm.context, cmdb); + if (verbs_is_destroy_err(&ret)) + return ret; + + return 0; } int ibv_cmd_reg_dm_mr(struct ibv_pd *pd, struct verbs_dm *dm, diff --git a/libibverbs/cmd_flow_action.c b/libibverbs/cmd_flow_action.c index 1782fb7..0bb8149 100644 --- a/libibverbs/cmd_flow_action.c +++ b/libibverbs/cmd_flow_action.c @@ -33,6 +33,7 @@ #include #include #include +#include static void scrub_esp_encap(struct ibv_flow_action_esp_encap *esp_encap) { @@ -120,9 +121,14 @@ int ibv_cmd_destroy_flow_action(struct verbs_flow_action *action) { DECLARE_COMMAND_BUFFER(cmd, UVERBS_OBJECT_FLOW_ACTION, UVERBS_METHOD_FLOW_ACTION_DESTROY, 1); + int ret; fill_attr_in_obj(cmd, UVERBS_ATTR_DESTROY_FLOW_ACTION_HANDLE, action->handle); - return execute_ioctl(action->action.context, cmd); + ret = execute_ioctl(action->action.context, cmd); + if (verbs_is_destroy_err(&ret)) + return ret; + + return 0; } diff --git a/libibverbs/libibverbs.map.in b/libibverbs/libibverbs.map.in index c6a65ad..80ef2a1 100644 --- a/libibverbs/libibverbs.map.in +++ b/libibverbs/libibverbs.map.in @@ -177,6 +177,7 @@ IBVERBS_PRIVATE_@IBVERBS_PABI_VERSION@ { ibv_cmd_resize_cq; ibv_query_gid_type; ibv_register_driver; + verbs_allow_disassociate_destroy; verbs_register_driver_@IBVERBS_PABI_VERSION@; verbs_set_ops; verbs_uninit_context; diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c index 25f0d5f..82efc4d 100644 --- a/providers/mlx5/verbs.c +++ b/providers/mlx5/verbs.c @@ -50,6 +50,7 @@ #include #include #include +#include #include "mlx5.h" #include "mlx5-abi.h" @@ -3606,6 +3607,7 @@ int mlx5dv_destroy_flow_matcher(struct mlx5dv_flow_matcher *flow_matcher) fill_attr_in_obj(cmd, MLX5_IB_ATTR_FLOW_MATCHER_DESTROY_HANDLE, flow_matcher->handle); ret = execute_ioctl(flow_matcher->context, cmd); + verbs_is_destroy_err(&ret); if (ret) return ret;