From patchwork Thu Jun 20 19:30:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13706282 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6828C27C79 for ; Thu, 20 Jun 2024 19:30:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C85076B035C; Thu, 20 Jun 2024 15:30:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C35366B035D; Thu, 20 Jun 2024 15:30:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFCD76B035E; Thu, 20 Jun 2024 15:30:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 926876B035C for ; Thu, 20 Jun 2024 15:30:19 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2CEDD140523 for ; Thu, 20 Jun 2024 19:30:19 +0000 (UTC) X-FDA: 82252258158.04.D7DDF2B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 6BE571C0008 for ; Thu, 20 Jun 2024 19:30:16 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FUI6f0C1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718911808; a=rsa-sha256; cv=none; b=Kb2/puQGZOIm9kYjInBJnWrcIg5zQdDbwcCDF8nedhhzy8Uz2hWLZLanzv4ZuR8mwQdtww hMD7yShQAEIFYGq6o91ZH4zD0TPGvhMdqT2ZmrD0evHS56yBnDJdEFemdnii/qXxkuVFmY NEuEGZz8ZH/63TfHoXUwCwsoVD5VbDU= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FUI6f0C1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718911808; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uwdtAySFtKK2OLXgT+61d7SC+sWlPRojSuQ75KtZ2Nc=; b=NongDar0i7bB8fG6sBqfqRzIInOHw+8c4iKDjvVQIbxOdeehlpGzy+x7qQ8xCEwramoaxH EhXaoppEaJ9nabR3qIySN3lAVz1dHZKUXTC3hEN+/uPZtcI63+ZLZO9tCqwUZ4/NI6umml GaP8Msfw+83IXkt5jBHQ83gKuWV1rEU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718911815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uwdtAySFtKK2OLXgT+61d7SC+sWlPRojSuQ75KtZ2Nc=; b=FUI6f0C1BlKurJ5u9Si4G8BSEO5GQDvIZpusJ8HiYN0vZuXOebgc6SmMNIc01W+W40zj62 tOU66ulr3j1V6ukmdvzKoUHkFLRWsDo+lViUDQ7NO+kIE+ASkPI84BD8qHiy0onWml0du9 +KdVUrgPhD/sq0Tb0hysolJ9J7im+Ic= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-A6ZZI-hHP42woi_qbb99ZA-1; Thu, 20 Jun 2024 15:30:13 -0400 X-MC-Unique: A6ZZI-hHP42woi_qbb99ZA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 81A401956088; Thu, 20 Jun 2024 19:30:08 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.195.156]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5E2001956087; Thu, 20 Jun 2024 19:30:01 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20240620173137.610345-10-dhowells@redhat.com> References: <20240620173137.610345-10-dhowells@redhat.com> <20240620173137.610345-1-dhowells@redhat.com> Cc: dhowells@redhat.com, Christian Brauner , Steve French , Matthew Wilcox , Jeff Layton , Gao Xiang , Dominique Martinet , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 09/17] cifs: Defer read completion MIME-Version: 1.0 Content-ID: <612370.1718911800.1@warthog.procyon.org.uk> Date: Thu, 20 Jun 2024 20:30:00 +0100 Message-ID: <612371.1718911800@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 6BE571C0008 X-Stat-Signature: c8aejpse1yed15kyty8tdpp6ri6sccpq X-Rspam-User: X-HE-Tag: 1718911816-551626 X-HE-Meta: U2FsdGVkX1/7RyRUBKyUXeRmWkXYIeWjYoBUun7UY6rN6HUXZvw7vmpMgZhprkmFxCK8Q6VHMLWndyGeT18S0icg7Xl+TyTfNFeZQyaofZw+xnFjtsmsPjOIs0xT2h2vFeUwP7fIwynRRIpAk59aSsJiBKG674GEPlmHRw2QPvKd3+NDKLtW18dGgOlYQeawViJ3SumhAb9v6zPfXl4Ffr0Aj/vx/+n0FaivdxlYiYoUXlkdtcfTWeYGplrp3pMMb6B67D6okVNj1HJ7jr7SJQLZ8RZCygI5w+7UUDNBjg58qrqwAiqn5JEAgPnW1QEdcNY5NkjtWPH5u3bWMC8oxWZY4wmTp64jTvLNby1Onxh33s8xTzhZkkV2fckxbSmoK9GNEUDMjNDg9Yk1N6UMUb7SuPFolHkRV3wzbePZH+otKlb9fBXh4Nk8bfR0RgBDMguXNJ8UDLfv6sUBSu2jIgkGAGd5OMg3dKxwislyjYYMmCSjvIttOIuTUcve2saruJVik2tnoLpvzhsUYeFkpfm6+1+5JmkVdLqiXrDVIDV1k2gb3dCj9B3zdCUqxHexk5ndcv1iGiWP7r9+ekXyk+ssbADAcuFsM2/OYLxpq7TYgeQ0x+Ooug7d3JCALZ7Azw/sgMGgv5PO7CLleLE8F0Bbr1q05JxH6BTr6B7ZC47beuNYc6wCSxZ0twQ0YWkv6leuTX21pztxe1z7MfTrgUd+US+DNTp8Z7YGOofLTQ9f7ekEgjPOimcpsQJ9EaqcDw9L69n72R9URLSppGX+Fuqn/+AEtvePy6REqADBwQXCA1wWhS24+JqbUBG60H4jOA2hYI/qlc/xzPXg2zJA0yBuF64sqAWbpxcvUPpmiXLplv+8Fqhcl+cULDgtwWqyCdKUQ9pVEbNwJV/WTNjmMri3voO4CtU8fesDCZE18XNJxASgM4Wg0pc2KG4v1YKLdR6mlJ180wb/YfdEISz cYGOIGcM DEbV/VBNtrrCYpvBdbHlV9gHKoAWlJSELwGr8wHPJZDw4Q08LquOPT74s05azR5BcaB4Bq/urw8oWKldCHlJtr5XjHrPSYENInCwI3aMSB1ZowWjCGdXAx8iT6fNByL8uqMxL0PVTSKmEbIIs6xUtMzGOMPQksYL0XlGcQewrzqJ0FR9gMi+gUOGmHGE3JxF1oVsXRypHZAKFXApShOX2lULnUsU+q0yypw/EGkemVbHpj+pqps3ebAXFl6qc2tiF33VdeR+sW4vC0zL+Ulxal+dW6mltKQMnbJMVo/2xOGUxuX4uOb8N7BIefvADSb3JiMXBcwaUcYJWIsjP5u9+HJc212oa30rYY+E0fJC+h6dU5ZgDAIO3iNTOwHGraOdPxNvs2+fYv/ttZ4EuL4os3e5cnJCb2zSp+wj50aGct9QrG8ul2deflDtvLhH8zwIei+/JN7EjUQw8uCMK5iKo7bxKajUZxqJk/VX6LUxZFgQK2O6R4cBY3ZhLrX/4b5P7IGus6gJIJLBliHDfFMNYpIXQ8cuFWXpnuq1u X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Oops - a bit of debugging code had got left in this patch and I forgot to fill out the description. Updated patch attached. David --- cifs: Defer read completion Defer read completion from the I/O thread to the cifsiod thread so as not to slow down the I/O thread. This restores the behaviour of v6.9. Signed-off-by: David Howells cc: Steve French cc: Paulo Alcantara cc: Jeff Layton cc: linux-cifs@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/smb/client/smb2pdu.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 38a06e8a0f90..e213cecd5094 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -4484,6 +4484,16 @@ smb2_new_read_req(void **buf, unsigned int *total_len, return rc; } +static void smb2_readv_worker(struct work_struct *work) +{ + struct cifs_io_subrequest *rdata = + container_of(work, struct cifs_io_subrequest, subreq.work); + + netfs_subreq_terminated(&rdata->subreq, + (rdata->result == 0 || rdata->result == -EAGAIN) ? + rdata->got_bytes : rdata->result, true); +} + static void smb2_readv_callback(struct mid_q_entry *mid) { @@ -4578,9 +4588,8 @@ smb2_readv_callback(struct mid_q_entry *mid) rdata->result = 0; } rdata->credits.value = 0; - netfs_subreq_terminated(&rdata->subreq, - (rdata->result == 0 || rdata->result == -EAGAIN) ? - rdata->got_bytes : rdata->result, true); + INIT_WORK(&rdata->subreq.work, smb2_readv_worker); + queue_work(cifsiod_wq, &rdata->subreq.work); release_mid(mid); add_credits(server, &credits, 0); }