{"id":2220577,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2220577/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/40c6cfe1b94a769eaae3c0f2327469efc8051edf.1775571957.git.metze@samba.org/","project":{"id":12,"url":"http://patchwork.ozlabs.org/api/1.1/projects/12/?format=json","name":"Linux CIFS Client","link_name":"linux-cifs-client","list_id":"linux-cifs.vger.kernel.org","list_email":"linux-cifs@vger.kernel.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<40c6cfe1b94a769eaae3c0f2327469efc8051edf.1775571957.git.metze@samba.org>","date":"2026-04-07T14:46:29","name":"[3/8] smb: smbdirect: fix the logic in smbdirect_socket_destroy_sync() without an error","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"631f123908d3f4a7e1a22f798050f722466f628f","submitter":{"id":8149,"url":"http://patchwork.ozlabs.org/api/1.1/people/8149/?format=json","name":"Stefan Metzmacher","email":"metze@samba.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/40c6cfe1b94a769eaae3c0f2327469efc8051edf.1775571957.git.metze@samba.org/mbox/","series":[{"id":498990,"url":"http://patchwork.ozlabs.org/api/1.1/series/498990/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=498990","date":"2026-04-07T14:46:28","name":"smb: add kernel internal IPPROTO_SMBDIRECT","version":1,"mbox":"http://patchwork.ozlabs.org/series/498990/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2220577/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2220577/checks/","tags":{},"headers":{"Return-Path":"\n <linux-cifs+bounces-10692-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-cifs@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (3072-bit key;\n secure) header.d=samba.org header.i=@samba.org header.a=rsa-sha256\n header.s=42 header.b=ZhixYXjT;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10692-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (3072-bit key) header.d=samba.org header.i=@samba.org\n header.b=\"ZhixYXjT\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=144.76.82.148","smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=samba.org","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=samba.org"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fqq1X6XHRz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 00:52:48 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 942BB3061551\n\tfor <incoming@patchwork.ozlabs.org>; Tue,  7 Apr 2026 14:47:42 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 084C930DEB8;\n\tTue,  7 Apr 2026 14:47:29 +0000 (UTC)","from hr2.samba.org (hr2.samba.org [144.76.82.148])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 0FD4D2EA48F\n\tfor <linux-cifs@vger.kernel.org>; Tue,  7 Apr 2026 14:47:25 +0000 (UTC)","from [127.0.0.2] (localhost [127.0.0.1])\n\tby hr2.samba.org with esmtpsa\n (TLS1.3:ECDHE_SECP256R1__ECDSA_SECP256R1_SHA256__CHACHA20_POLY1305:256)\n\t(Exim)\n\tid 1wA7i6-00000007WPL-1ja1;\n\tTue, 07 Apr 2026 14:47:22 +0000"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775573248; cv=none;\n b=Zo4xR9vmk2TJRM+mu3qGGLoXqAfSHEuq9Nsq170p068WP6qZeiIs776EJpNdXoD09noAVcfhLvUfA3M7dkl2eQA7YXoQYi9QLIaQeaf0Cqnp47VyHp/chCzlxPW8timACpM4kLn8AfpNKv0vQBtIz/mOtTQluXRgsu+ig3i67TI=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775573248; c=relaxed/simple;\n\tbh=CrwMUloToJ3c9Pkfe8jLFlvt6GE63J6mLanySCop9qM=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=GXxa2se1EIlEMhc+gOnpTmaqYXk6q//wSXW5EjQIBAFEEqi9H9shtQ+Tdiwr/Im1spp/1CBCSXXwEEhB6hajE1eyDioh+rAxkndH9WDITppR/Esvnp/dQhkA1E5Vze8Fd1iWXsC1bAKnugKjiriIxpvSlXfLMTc2aiJTctmwkDU=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=samba.org;\n spf=pass smtp.mailfrom=samba.org;\n dkim=pass (3072-bit key) header.d=samba.org header.i=@samba.org\n header.b=ZhixYXjT; arc=none smtp.client-ip=144.76.82.148","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org;\n\ts=42; h=Message-ID:Date:Cc:To:From;\n\tbh=zekklSUDzJym1GfQf+o36pxNte8IK8yarYqm9s6KeV8=; b=ZhixYXjTPrhYbxe7T5q1VkKrlQ\n\tVCZdjxOv1myy3vel5F0w7x3+8nA9U2RFwSZRHdqOmYs3tIe5+q/EU+x+pLGqlw6qrcKNwrdNvHIfh\n\tQ03V1opDzJjrIWfow42QzBkRHFrUF1M1Yx/jBYRycnirlmELpnhOlh3BiKJBkp2TCgYfvgrYYamEo\n\thyM/N0ph5ANdAbxWNPun/wkqqmDKEAecUKogEpuTWPs2bvTw4sHnqr/s7THPQ4EV3bbaPLoNxxB15\n\txJ+rqQFmFI5GZYTw+9n74X3WdDm0pb5q51vaxvzw7AEyOEHiNCxwvR9YZlIjZQdX2Y0hy/aObuCO+\n\tYKEjXjatDkwhQVf+fV5uhdm6WkAmXihLjlGG0mRz6xqZuc2WdRJm7t5FWmLGkwjppr+srw1sDyDbG\n\tKZ/WBwY3Loh/6Wc5JohIYcG5ZeZ4ibupUyFwoEkqzx6vcjoonXVnV3JwvSNm+oBS3yFQauwMFN+iO\n\tgUZvuYqLqRsSswAsbTvhLz2m;","From":"Stefan Metzmacher <metze@samba.org>","To":"linux-cifs@vger.kernel.org,\n\tsamba-technical@lists.samba.org","Cc":"metze@samba.org,\n\tSteve French <smfrench@gmail.com>,\n\tTom Talpey <tom@talpey.com>,\n\tLong Li <longli@microsoft.com>,\n\tNamjae Jeon <linkinjeon@kernel.org>,\n\tDavid Howells <dhowells@redhat.com>,\n\tHenrique Carvalho <henrique.carvalho@suse.com>","Subject":"[PATCH 3/8] smb: smbdirect: fix the logic in\n smbdirect_socket_destroy_sync() without an error","Date":"Tue,  7 Apr 2026 16:46:29 +0200","Message-ID":"\n <40c6cfe1b94a769eaae3c0f2327469efc8051edf.1775571957.git.metze@samba.org>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<cover.1775571957.git.metze@samba.org>","References":"<cover.1775571957.git.metze@samba.org>","Precedence":"bulk","X-Mailing-List":"linux-cifs@vger.kernel.org","List-Id":"<linux-cifs.vger.kernel.org>","List-Subscribe":"<mailto:linux-cifs+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-cifs+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"If smbdirect_socket_destroy_sync() and sc->first_error was not set\nwe should set -ESHUTDOWN, that's a better condition\ndoing it only implicitly with the\nsc->status < SMBDIRECT_SOCKET_DISCONNECTING check.\n\nCc: Steve French <smfrench@gmail.com>\nCc: Tom Talpey <tom@talpey.com>\nCc: Long Li <longli@microsoft.com>\nCc: Namjae Jeon <linkinjeon@kernel.org>\nCc: David Howells <dhowells@redhat.com>\nCc: Henrique Carvalho <henrique.carvalho@suse.com>\nCc: linux-cifs@vger.kernel.org\nCc: samba-technical@lists.samba.org\nSigned-off-by: Stefan Metzmacher <metze@samba.org>\n---\n fs/smb/common/smbdirect/smbdirect_socket.c | 28 ++++++++++++++++------\n 1 file changed, 21 insertions(+), 7 deletions(-)","diff":"diff --git a/fs/smb/common/smbdirect/smbdirect_socket.c b/fs/smb/common/smbdirect/smbdirect_socket.c\nindex 4003753bea26..9153e1dbf53d 100644\n--- a/fs/smb/common/smbdirect/smbdirect_socket.c\n+++ b/fs/smb/common/smbdirect/smbdirect_socket.c\n@@ -600,13 +600,20 @@ void smbdirect_socket_destroy_sync(struct smbdirect_socket *sc)\n \t */\n \tWARN_ON_ONCE(in_interrupt());\n \n-\tsmbdirect_log_rdma_event(sc, SMBDIRECT_LOG_INFO,\n-\t\t\"cancelling and disable disconnect_work\\n\");\n-\tdisable_work_sync(&sc->disconnect_work);\n+\t/*\n+\t * First we try to disable the work\n+\t * without disable_work_sync() in a\n+\t * non blocking way, if it's already\n+\t * running it will be handles by\n+\t * disable_work_sync() below.\n+\t *\n+\t * Here we just want to make sure queue_work() in\n+\t * smbdirect_socket_schedule_cleanup_lvl()\n+\t * is a no-op.\n+\t */\n+\tdisable_work(&sc->disconnect_work);\n \n-\tsmbdirect_log_rdma_event(sc, SMBDIRECT_LOG_INFO,\n-\t\t\"destroying rdma session\\n\");\n-\tif (sc->status < SMBDIRECT_SOCKET_DISCONNECTING) {\n+\tif (!sc->first_error)\n \t\t/*\n \t\t * SMBDIRECT_LOG_INFO is enough here\n \t\t * as this is the typical case where\n@@ -615,8 +622,15 @@ void smbdirect_socket_destroy_sync(struct smbdirect_socket *sc)\n \t\tsmbdirect_socket_schedule_cleanup_lvl(sc,\n \t\t\t\t\t\t      SMBDIRECT_LOG_INFO,\n \t\t\t\t\t\t      -ESHUTDOWN);\n+\n+\tsmbdirect_log_rdma_event(sc, SMBDIRECT_LOG_INFO,\n+\t\t\"cancelling and disable disconnect_work\\n\");\n+\tdisable_work_sync(&sc->disconnect_work);\n+\n+\tsmbdirect_log_rdma_event(sc, SMBDIRECT_LOG_INFO,\n+\t\t\"destroying rdma session\\n\");\n+\tif (sc->status < SMBDIRECT_SOCKET_DISCONNECTING)\n \t\tsmbdirect_socket_cleanup_work(&sc->disconnect_work);\n-\t}\n \tif (sc->status < SMBDIRECT_SOCKET_DISCONNECTED) {\n \t\tsmbdirect_log_rdma_event(sc, SMBDIRECT_LOG_INFO,\n \t\t\t\"wait for transport being disconnected\\n\");\n","prefixes":["3/8"]}