From patchwork Mon Sep 17 21:35:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603485 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 C06BA1508 for ; Mon, 17 Sep 2018 22:19:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD1F92A769 for ; Mon, 17 Sep 2018 22:19:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0AD62A771; Mon, 17 Sep 2018 22:19:32 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 1B1DE2A769 for ; Mon, 17 Sep 2018 22:19:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728202AbeIRDss (ORCPT ); Mon, 17 Sep 2018 23:48:48 -0400 Received: from com-out001.mailprotect.be ([83.217.72.83]:47211 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbeIRDss (ORCPT ); Mon, 17 Sep 2018 23:48:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=cANx23MfagyZkk5lokPjbnH4DmfhrzVjkjhJA5MGTlQ=; b=CitJhY2696Gz 5/vzbzHYJjsDYppaHb8W4HSAFr/giUt/vDNKr9PM3rIni2Syp/9h/evd0Zf2MfValeJ6sD0BrRJjW gPm70CC7Cgr0fmmk3FaSuBoETj2N4n7eRBQz1sr80CqvRO835rfhuIk0z7+HQrf7JIkept22JxL10 n8AdEARqeBsIhnI05ZJWr05mNChkXjmkpMV9pxpHXt7l521Ob/mEwgcVGp6VZSc5AbwyQeaMdVt6O HWhUE7CJkil4gCZed78LWTe74t9KWJI22pQtnQpBfs6UdaOY3tfmLJVyp7VLK3rWnBkthKMa7E83T mRdXKgWgufS/ii5GZL2W2w==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21Bp-000Aqq-JT; Mon, 17 Sep 2018 23:36:18 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 849D4C0718; Mon, 17 Sep 2018 23:36:15 +0200 (CEST) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , Mike Christie , Hannes Reinecke Subject: [PATCH 04/17] target/core: Change the return type of transport_init_session from void to int Date: Mon, 17 Sep 2018 14:35:41 -0700 Message-Id: <20180917213554.987-5-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: SB/global_tokens (0.00302830772372) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5mMB0HYYerFNJys+bgBV30F602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7DeYhznVP/hHedXEXThVsO8902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6NiSg6RpPztwkEB6XvRg4fu70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc58Ll8a8FpFadZ7pYW176HUcFBAvuf345 Nnfstl8j+xbfRhkyBRfpnhOGU4XFO7gtKC2E20DCkTOs2+ui7lx1JaQBJ7TPMihJUfmPOEFZaWM/ T5itzfIn+EMb8n8rPGwij/JciTrXxhUmnmMzaRlxSAc9RvDsJWk2iVzNKhO4mxGcQ2xIQII6zLiS K1DYRU43uqYyuJysWxxCMQNM9mabIB0IiaU4gAI/mVwx8NCEKdHPrEjKCQJ0RwcvM0tk+e9c6n99 h0QCFy8UsY0CLj0GXrB5qPrmLnSSifG4ucd7W6Uv3SLeYSvLqlmLas2NEyjp4Q+z8HkVHYPFDbqs chOAY1Vdc2K+waea2lUOnotr/fNQvy23SZXSfMZ7RzHGH1l2naPKc3yQvxQmzKsAiXiBbGB3kq59 Hfp5AEkboNOV6PUf4ngLmK0LObbZiXBeyQEpViU4oE+ncQYpfHQGnNPTwRxrN3XQ8ABQoz/Q6PkR ZAZ326zBXCRRkPNZOeZhl83ItgZkcRkCnoMzps1w8ZlyWp5OlwYUQ1ejeQ1GJqZGMW0WCHtA05KY Hui9AUj7nFxAZyCgxZHINA6A5+7T9o6byzvDwAcft/nzfIptzPRrK2/ShgkK/IUjCNCeBQgjifLR QVNUvx4T911LgXOuhzWRBTEvuGslKTrRIXcXpFg5ivY= X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 does not change any functionality but makes the next patch in this series easier to read. Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke --- drivers/target/target_core_transport.c | 10 ++++++++-- drivers/target/target_core_xcopy.c | 6 +++++- include/target/target_core_fabric.h | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 2c0d8626d57d..94e9d03af99d 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -230,13 +230,14 @@ void transport_subsystem_check_init(void) * * The caller must have zero-initialized @se_sess before calling this function. */ -void transport_init_session(struct se_session *se_sess) +int transport_init_session(struct se_session *se_sess) { INIT_LIST_HEAD(&se_sess->sess_list); INIT_LIST_HEAD(&se_sess->sess_acl_list); INIT_LIST_HEAD(&se_sess->sess_cmd_list); spin_lock_init(&se_sess->sess_cmd_lock); init_waitqueue_head(&se_sess->cmd_list_wq); + return 0; } EXPORT_SYMBOL(transport_init_session); @@ -247,6 +248,7 @@ EXPORT_SYMBOL(transport_init_session); struct se_session *transport_alloc_session(enum target_prot_op sup_prot_ops) { struct se_session *se_sess; + int ret; se_sess = kmem_cache_zalloc(se_sess_cache, GFP_KERNEL); if (!se_sess) { @@ -254,7 +256,11 @@ struct se_session *transport_alloc_session(enum target_prot_op sup_prot_ops) " se_sess_cache\n"); return ERR_PTR(-ENOMEM); } - transport_init_session(se_sess); + ret = transport_init_session(se_sess); + if (ret < 0) { + kfree(se_sess); + return ERR_PTR(ret); + } se_sess->sup_prot_ops = sup_prot_ops; return se_sess; diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 70adcfdca8d1..124495f953fa 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -479,6 +479,8 @@ static const struct target_core_fabric_ops xcopy_pt_tfo = { int target_xcopy_setup_pt(void) { + int ret; + xcopy_wq = alloc_workqueue("xcopy_wq", WQ_MEM_RECLAIM, 0); if (!xcopy_wq) { pr_err("Unable to allocate xcopy_wq\n"); @@ -496,7 +498,9 @@ int target_xcopy_setup_pt(void) INIT_LIST_HEAD(&xcopy_pt_nacl.acl_list); INIT_LIST_HEAD(&xcopy_pt_nacl.acl_sess_list); memset(&xcopy_pt_sess, 0, sizeof(struct se_session)); - transport_init_session(&xcopy_pt_sess); + ret = transport_init_session(&xcopy_pt_sess); + if (ret < 0) + return ret; xcopy_pt_nacl.se_tpg = &xcopy_pt_tpg; xcopy_pt_nacl.nacl_sess = &xcopy_pt_sess; diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index f4147b398431..eb9d0923c55c 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -116,7 +116,7 @@ struct se_session *target_setup_session(struct se_portal_group *, struct se_session *, void *)); void target_remove_session(struct se_session *); -void transport_init_session(struct se_session *); +int transport_init_session(struct se_session *se_sess); struct se_session *transport_alloc_session(enum target_prot_op); int transport_alloc_session_tags(struct se_session *, unsigned int, unsigned int);