From patchwork Tue Aug 30 12:39:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guoqing Jiang X-Patchwork-Id: 12959283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 424A8ECAAA1 for ; Tue, 30 Aug 2022 12:40:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229740AbiH3MkA (ORCPT ); Tue, 30 Aug 2022 08:40:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbiH3Mj6 (ORCPT ); Tue, 30 Aug 2022 08:39:58 -0400 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20E1F12F555 for ; Tue, 30 Aug 2022 05:39:39 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1661863172; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+Ol9Yn3rS0Ef5GAu+q877yCKMkEWCXTaYE03ZGnPBQU=; b=EoGwa4ZvVCvDVoiqQR/PRITzM5ovorBryauYpvJcPQrQObCtyP8JJSMFKKz+702V2TF1MS bshLVGjUY+Q1DywEORA7yxLstbCwVm6Y6gDmSX5xFtqjaa17dNcMlDNJQ5njYCJb+3wJGa sUvGPDTm0oGJ3dodmrBvsZ+OXjTZXhw= From: Guoqing Jiang To: haris.iqbal@ionos.com, jinpu.wang@ionos.com, axboe@kernel.dk Cc: linux-block@vger.kernel.org Subject: [PATCH 1/3] rnbd-srv: fix the return value of rnbd_srv_rdma_ev Date: Tue, 30 Aug 2022 20:39:02 +0800 Message-Id: <20220830123904.26671-2-guoqing.jiang@linux.dev> In-Reply-To: <20220830123904.26671-1-guoqing.jiang@linux.dev> References: <20220830123904.26671-1-guoqing.jiang@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Since process_msg_open could fail, we should return 'ret' instead of '0' at the end of function. Fixes: 2de6c8de192b ("block/rnbd: server: main functionality") Signed-off-by: Guoqing Jiang Reviewed-by: Chaitanya Kulkarni --- drivers/block/rnbd/rnbd-srv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index 3f6c268e04ef..9182d45cb9be 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -403,7 +403,7 @@ static int rnbd_srv_rdma_ev(void *priv, } rtrs_srv_resp_rdma(id, ret); - return 0; + return ret; } static struct rnbd_srv_sess_dev From patchwork Tue Aug 30 12:39:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guoqing Jiang X-Patchwork-Id: 12959282 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46AE7ECAAA1 for ; Tue, 30 Aug 2022 12:39:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229530AbiH3Mj5 (ORCPT ); Tue, 30 Aug 2022 08:39:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229773AbiH3Mjs (ORCPT ); Tue, 30 Aug 2022 08:39:48 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B91CB12F566 for ; Tue, 30 Aug 2022 05:39:37 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1661863175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1uABKaL7W78FC9Mz+iS0yPDmNTix2+XHt/nypCOiyDA=; b=EnpHq85q8fkHCruCSoxcBaO2kmABzivzjtDQVH00poTGy9O0zCa+OfA+SgcuJSP6sEH8fX +ZjNevDCZjcOGA4lJy8X73+9irUc8iTkKgyYko1VN2LSQd0oK1m94GjCiCZHP+TFVe5yT5 DBByRvSBOoT+2TbLgjF+h1djygTTS2c= From: Guoqing Jiang To: haris.iqbal@ionos.com, jinpu.wang@ionos.com, axboe@kernel.dk Cc: linux-block@vger.kernel.org Subject: [PATCH 2/3] rnbd-srv: make process_msg_close returns void Date: Tue, 30 Aug 2022 20:39:03 +0800 Message-Id: <20220830123904.26671-3-guoqing.jiang@linux.dev> In-Reply-To: <20220830123904.26671-1-guoqing.jiang@linux.dev> References: <20220830123904.26671-1-guoqing.jiang@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Change the return type to void given it always returns 0. Signed-off-by: Guoqing Jiang Reviewed-by: Chaitanya Kulkarni Acked-by: Md Haris Iqbal --- process_msg_sess_info also returns 0, to avoid conflict with rdma tree, will send it in next merge window. drivers/block/rnbd/rnbd-srv.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index 9182d45cb9be..026681a70c46 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -339,7 +339,7 @@ void rnbd_srv_sess_dev_force_close(struct rnbd_srv_sess_dev *sess_dev, mutex_unlock(&sess->lock); } -static int process_msg_close(struct rnbd_srv_session *srv_sess, +static void process_msg_close(struct rnbd_srv_session *srv_sess, void *data, size_t datalen, const void *usr, size_t usrlen) { @@ -351,13 +351,12 @@ static int process_msg_close(struct rnbd_srv_session *srv_sess, sess_dev = rnbd_get_sess_dev(le32_to_cpu(close_msg->device_id), srv_sess); if (IS_ERR(sess_dev)) - return 0; + return; rnbd_put_sess_dev(sess_dev); mutex_lock(&srv_sess->lock); rnbd_srv_destroy_dev_session_sysfs(sess_dev); mutex_unlock(&srv_sess->lock); - return 0; } static int process_msg_open(struct rnbd_srv_session *srv_sess, @@ -387,7 +386,7 @@ static int rnbd_srv_rdma_ev(void *priv, case RNBD_MSG_IO: return process_rdma(srv_sess, id, data, datalen, usr, usrlen); case RNBD_MSG_CLOSE: - ret = process_msg_close(srv_sess, data, datalen, usr, usrlen); + process_msg_close(srv_sess, data, datalen, usr, usrlen); break; case RNBD_MSG_OPEN: ret = process_msg_open(srv_sess, usr, usrlen, data, datalen); From patchwork Tue Aug 30 12:39:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guoqing Jiang X-Patchwork-Id: 12959281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEFF2ECAAA1 for ; Tue, 30 Aug 2022 12:39:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229484AbiH3Mjx (ORCPT ); Tue, 30 Aug 2022 08:39:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbiH3Mjs (ORCPT ); Tue, 30 Aug 2022 08:39:48 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1EFB12F571 for ; Tue, 30 Aug 2022 05:39:40 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1661863178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M7uM+dEC8iPW0bDtb/BhfLMToCK2jloinourCEMiEeA=; b=Vc5dP87wuxPmifjfnQj/BtBG+S5yTo+czq3rS+iMCRRK4jr0trJfgHxRgmghNnFMaRpBWw cMr9dq4oZG7WTTwR1YTKsLawvNdV/EzMpWRFpMVzFYSF9GPvEnizEdvHizi23zIU//heud miIfydSRbFfMi4VRZPR3/7BNM6PYwN8= From: Guoqing Jiang To: haris.iqbal@ionos.com, jinpu.wang@ionos.com, axboe@kernel.dk Cc: linux-block@vger.kernel.org Subject: [PATCH 3/3] rnbd-srv: remove redundant setting of blk_open_flags Date: Tue, 30 Aug 2022 20:39:04 +0800 Message-Id: <20220830123904.26671-4-guoqing.jiang@linux.dev> In-Reply-To: <20220830123904.26671-1-guoqing.jiang@linux.dev> References: <20220830123904.26671-1-guoqing.jiang@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org It is not necessary since it is set later just before function return success. Signed-off-by: Guoqing Jiang Reviewed-by: Chaitanya Kulkarni Acked-by: Md Haris Iqbal --- drivers/block/rnbd/rnbd-srv-dev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/block/rnbd/rnbd-srv-dev.c b/drivers/block/rnbd/rnbd-srv-dev.c index c63017f6e421..38131fa5718d 100644 --- a/drivers/block/rnbd/rnbd-srv-dev.c +++ b/drivers/block/rnbd/rnbd-srv-dev.c @@ -21,7 +21,6 @@ struct rnbd_dev *rnbd_dev_open(const char *path, fmode_t flags) if (!dev) return ERR_PTR(-ENOMEM); - dev->blk_open_flags = flags; dev->bdev = blkdev_get_by_path(path, flags, THIS_MODULE); ret = PTR_ERR_OR_ZERO(dev->bdev); if (ret)