From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 721E1C05051 for ; Tue, 8 Aug 2023 16:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OF7WLU7/ths3+BsX6VY5DxCk4Gv+NH5Tw3dU93NLfxs=; b=a6CE4HUw9Qb00ILV4qrHoYj+uq 4pcPhBcX5NWyfupfHGodLHGRLKrncmFLFLnruS4GmPtgR6j3qALmOnZNGFzio3d0BhTnLJDUgIrB2 dBzbfFh95Xyo6BNksCqqGX4XNHnJJeWh29kwlTwzQPkr4D+EOIR+sM7pUNl0JL2gWD9aU+5CSk302 XVfa2NIF0PMRrCQ9bCwuwsAcTqLpyLkKGkopMATmPSwlTcokcF2Bvvwu4UEyXlGmB/L2bNqmFJW05 7qekL2TPG7TCNdGVwt88EvHdLKgVv4/dVEQi9AVO2ALN5nnxqhiPf2MSrVHwymloBBQwA1R3jR0mN VWGpiCTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTPyP-00323n-2c; Tue, 08 Aug 2023 16:54:21 +0000 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTPyG-0031wl-0d for linux-nvme@lists.infradead.org; Tue, 08 Aug 2023 16:54:17 +0000 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 3AB492001A; Tue, 8 Aug 2023 16:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691513648; h=from:from:reply-to: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=OF7WLU7/ths3+BsX6VY5DxCk4Gv+NH5Tw3dU93NLfxs=; b=QQHHTobYBl0fEvkFZWHjJqe5u2ojnXmW50oCzVh3wNdrlZI4LSlT6kkC2j1O1ZxPO/hwUb dlVCm9BXZWAYyJ3JAsbWEVMgoECiAz7vPGiJtNoC8gBDWtnQZ2wRZlSTtFBHtQH8RazGqM zm+h6aQDbz3FMzYccUe+7evRXvXJ4vA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691513648; h=from:from:reply-to: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=OF7WLU7/ths3+BsX6VY5DxCk4Gv+NH5Tw3dU93NLfxs=; b=LQed36UtXWjsjcOYeOLL3VATSjmiKuxpOwyH1JnBozkzn1ezJbr8jOlEbf6lPUbv4lsR8a bb6xwZgUxlTf04Cg== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 2E6852C14F; Tue, 8 Aug 2023 16:54:08 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 2717B51CACF3; Tue, 8 Aug 2023 18:54:08 +0200 (CEST) From: Hannes Reinecke To: Christoph Hellwig Cc: Sagi Grimberg , Keith Busch , linux-nvme@lists.infradead.org, Hannes Reinecke Subject: [PATCH 07/16] nvme-tcp: allocate socket file Date: Tue, 8 Aug 2023 18:53:45 +0200 Message-Id: <20230808165354.123499-8-hare@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230808165354.123499-1-hare@suse.de> References: <20230808165354.123499-1-hare@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230808_095414_922532_20924BC1 X-CRM114-Status: GOOD ( 13.21 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org When using the TLS upcall we need to allocate a socket file such that the userspace daemon is able to use the socket. Signed-off-by: Hannes Reinecke --- drivers/nvme/host/tcp.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 9ce417cd32a7..c05037c29da0 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1338,7 +1338,9 @@ static void nvme_tcp_free_queue(struct nvme_ctrl *nctrl, int qid) } noreclaim_flag = memalloc_noreclaim_save(); - sock_release(queue->sock); + /* ->sock will be released by fput() */ + fput(queue->sock->file); + queue->sock = NULL; memalloc_noreclaim_restore(noreclaim_flag); kfree(queue->pdu); @@ -1512,6 +1514,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid) struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl); struct nvme_tcp_queue *queue = &ctrl->queues[qid]; int ret, rcv_pdu_size; + struct file *sock_file; mutex_init(&queue->queue_lock); queue->ctrl = ctrl; @@ -1534,6 +1537,13 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid) goto err_destroy_mutex; } + sock_file = sock_alloc_file(queue->sock, O_CLOEXEC, NULL); + if (IS_ERR(sock_file)) { + sock_release(queue->sock); + queue->sock = NULL; + ret = PTR_ERR(sock_file); + goto err_destroy_mutex; + } nvme_tcp_reclassify_socket(queue->sock); /* Single syn retry */ @@ -1640,7 +1650,8 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid) if (queue->hdr_digest || queue->data_digest) nvme_tcp_free_crypto(queue); err_sock: - sock_release(queue->sock); + /* ->sock will be released by fput() */ + fput(queue->sock->file); queue->sock = NULL; err_destroy_mutex: mutex_destroy(&queue->send_mutex); -- 2.35.3