From patchwork Mon Sep 23 15:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13809700 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 4092CCF9C72 for ; Mon, 23 Sep 2024 15:08:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B36B16B0085; Mon, 23 Sep 2024 11:08:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AE7246B0088; Mon, 23 Sep 2024 11:08:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9ADF16B0089; Mon, 23 Sep 2024 11:08:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 77A376B0085 for ; Mon, 23 Sep 2024 11:08:28 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 01C371C6BAC for ; Mon, 23 Sep 2024 15:08:27 +0000 (UTC) X-FDA: 82596334296.11.36D3525 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 38071160018 for ; Mon, 23 Sep 2024 15:08:26 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Cy5T7kp4; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf08.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727104010; a=rsa-sha256; cv=none; b=Z7nTFoEMuAZqGhJk7YbQzgnwzUV1b5jAJP5xoqtK5XaLQ9sxjgR7fTBDrlc1W7poty8S+O FuvnFivyTO0iu39j9SYkIYbD9brT8H8T9o7DSTjN1Gq+48rEw9Z9jEHGFG22MX7KdnjO7J zCnmHdsYPCdRVAJnCGQIDCDeRrpH5L8= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Cy5T7kp4; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf08.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1727104010; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=UHKFm+zddtgJAu8raP8xj5T/wroKl8vpea/DCvZ5VL0=; b=Dr57aDrNQeuQ8/PSb4jsD+3U08R76ofzj+OsMdp6apP8X1S3dv3Z/vJnDfYuKISUfAN5D5 voLeyYiCzF9Diu9dx55TGRPYycRke1PnWjnVYQgNEq6JRAVXfrooRvK20424PejR8/2byi oyRDlJbKrjop7cnqVTIg2qcOZ1Eb5Ls= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727104105; 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=UHKFm+zddtgJAu8raP8xj5T/wroKl8vpea/DCvZ5VL0=; b=Cy5T7kp43j6ZIX0rZTJf/xV3Y4iWo8mFqNR30ZEODUTXef1k+g0I2P6Sio3g6U0LEpZY15 vC91V/1O52xoupf4nkNJVIb1QsOo0bdp0WvpOlEsfCNt+GNx9aLXMKm7tz00MTvvgyvWqW OT1U1EairVBLsGPIu1bUT/Jep08j+J4= Received: from mx-prod-mc-03.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-439-YwYfIXcXPKSEJj725uT1xQ-1; Mon, 23 Sep 2024 11:08:20 -0400 X-MC-Unique: YwYfIXcXPKSEJj725uT1xQ-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.12]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 59BFD18E6A7E; Mon, 23 Sep 2024 15:08:18 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.145]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9EE911954190; Mon, 23 Sep 2024 15:08:06 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Marc Dionne Cc: David Howells , Paulo Alcantara , Jeff Layton , Matthew Wilcox , 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, linux-kernel@vger.kernel.org, kernel test robot Subject: [PATCH 1/8] netfs: Fix mtime/ctime update for mmapped writes Date: Mon, 23 Sep 2024 16:07:45 +0100 Message-ID: <20240923150756.902363-2-dhowells@redhat.com> In-Reply-To: <20240923150756.902363-1-dhowells@redhat.com> References: <20240923150756.902363-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 38071160018 X-Stat-Signature: mfcxsrmcq1funt39moz8qu59f5f89ns6 X-Rspam-User: X-HE-Tag: 1727104106-509754 X-HE-Meta: U2FsdGVkX1+V06WnE9zGvr/Qd0eShcDKDUy/hvJIb2GC9B3aX44MMPPfXXawmRQktoTnCWxmjJEIQsnrvJ/3OKYBRjXH9Xm1Eeot0eHqWSNhVzSnkKEcDa2v0DhJPIlBiHT+XvTfynw0FFGBOP+zSTBETI1VyjTvArOhAgjwjOj/wiAb8RxmBw2vDCgdSAigxrF9jDIow/rCHbuFKLWSB666WBpdh4xLFPziJhesVTESpQ655Lqu4ywc4E8sMSp/yF0U6D6Ib4Po40ck4M+1k8lq6+Pqe0kXU9e0YMxC8QwBm/QXNhKaDEUcoG1arss5KAe1nAa33Ls3kV4b+NOhLJJM/Q4F9YT4lqnXd7FkipWeCD1XyXxF5u/k8gEwbmouDXdKqEDsobp4YhRbwIa9j3Jutp5YSJaddjc3A86zvaXLUWjv+CLzV3KXH7jodsxYQY5Z5D343P9ekY6HbwEtO5PyEwQqVGrSVNk76prWkMAEyvW5f5MZywc4eq17zIGcrxpW5yn4qqM8/+1C9/TYrppc0/xb+/2CmDmCPCi50W09p40ujLguvEvYIZoWQhlUXOWn65dVUBuZ8r0782AN/xzIAw/kMIcrNpDgdbw/op0YYeuzVDZ/bdWoAln37jGuH4oqYYpVQm3Ti7D73KNL6AafcXZsbLeJGxMXkOgNUW536jnvJ6yBfYQJp3LoeWHqtLwgvrG0Hgy1pYwNM0KPuAsBJt0a4WYHG7ADWEcpquNRs7T2aP4jl9lG///wNje8/57q0LFZQy0MocAM8eqPvJly5tF4at8bURvxJENqH02nNeBVdk37QUJax2zQSOje/W6B9BNuEm+MU6ETzvdNm+Y58j2XTTsCPsbrNQe80UYlri6AkvE3Sscdr+sXfLcnuiBbx3wcGoJNiu5QB6wZ1wq2niUfUzSIIcVRpn/RnpeftUaX5SXb5EhKxAbTdcSi5elPpgGY8g3LBBB1/w4 pdHwZgbM Pu4BQ7bIYnm1Uu9lXz471ZK5VMy3gGAMG3UToE/4EqKMjbF36kWxAq9aJZKh35dR691c+6vORACEl/g9bUHTH+Y8stNpay2A7n9OX77NKNVFVxjY861hTrWvYO4NsqqgAAtI2XIEvvtgaH0d7BY6AKe9IkduN2pjzsceBqkUyoIaXn9zKE3UvaPjUGOXOlaU2h/KRaMISsnwoZugbkS6YJcZF/Ggzs91rxw/XYdI1QOQevVyPNHAnBW5dkEs7QjjVr1nRpffHiK9Ra4xZjAlf74WthUxPAqBPE36Qb6RvqvtBLBJNoPyj2u5znb4jbzHgcasPqRbjYoO75aNXS5eIzez6K3cdANqDwT9N8K2mr5/j8CpdLZx2a30+vG9sCWX3NiAU3dQjWMbp71muevu1U+oblIcDUjoj4DM89B3XwXawIQsRJq3h3N6HuZ2ORLb3Vzf2Rq0/1Hr8YFXN6FyahbmvEbLC47580WHrupqpTPkf6ic= 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: The cifs flag CIFS_INO_MODIFIED_ATTR, which indicates that the mtime and ctime need to be written back on close, got taken over by netfs as NETFS_ICTX_MODIFIED_ATTR to avoid the need to call a function pointer to set it. The flag gets set correctly on buffered writes, but doesn't get set by netfs_page_mkwrite(), leading to occasional failures in generic/080 and generic/215. Fix this by setting the flag in netfs_page_mkwrite(). Fixes: 73425800ac94 ("netfs, cifs: Move CIFS_INO_MODIFIED_ATTR to netfs_inode") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202409161629.98887b2-oliver.sang@intel.com Signed-off-by: David Howells cc: Jeff Layton cc: Steve French cc: Paulo Alcantara cc: linux-cifs@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/netfs/buffered_write.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c index d7eae597e54d..b3910dfcb56d 100644 --- a/fs/netfs/buffered_write.c +++ b/fs/netfs/buffered_write.c @@ -552,6 +552,7 @@ vm_fault_t netfs_page_mkwrite(struct vm_fault *vmf, struct netfs_group *netfs_gr trace_netfs_folio(folio, netfs_folio_trace_mkwrite); netfs_set_group(folio, netfs_group); file_update_time(file); + set_bit(NETFS_ICTX_MODIFIED_ATTR, &ictx->flags); if (ictx->ops->post_modify) ictx->ops->post_modify(inode); ret = VM_FAULT_LOCKED; From patchwork Mon Sep 23 15:07:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13809701 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 6404FCF9C6F for ; Mon, 23 Sep 2024 15:08:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D81366B0088; Mon, 23 Sep 2024 11:08:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D305D6B0089; Mon, 23 Sep 2024 11:08:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD2946B008A; Mon, 23 Sep 2024 11:08:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9A1346B0088 for ; Mon, 23 Sep 2024 11:08:30 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 555961A1422 for ; Mon, 23 Sep 2024 15:08:30 +0000 (UTC) X-FDA: 82596334380.02.496C4DD Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 7C4CE80012 for ; Mon, 23 Sep 2024 15:08:27 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Pwb67pDz; spf=pass (imf02.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727103990; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gjwTy2CufmK+GO1xgTXd2oAVeAy0cQHbPCXVo8T8uFE=; b=VslnnRprKlGbYvc/OY0UR54JGXiUGyYSvW+f0L2y4KoFZaky+9+hEDi5m0vYhq8+sdbZq+ WsiVr3Gu3vxWyArnc+zQNVe4sbEUTcNkocTnMdVD+U1MkE/QtYRPWGxbjtGJPwEhzyFnRF +ZA/J8ZMOMSEG9EIDnqMDacIbr6tdEo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727103990; a=rsa-sha256; cv=none; b=6Vz+Pxnd9qdp3tFylDH+Pe9uBOhLFs8HbfhD0+DY267R5WQDzSkYdk/++E/6BaCemYBSeg dqA/XYU3sOvatuBY3moAlrr1d2SY+UbxjBjBzGVKa6uK9Ct4V4AEkGgMp/FNaXhr/ON6Cx DnGLk2aE3H3pXRPOcOj/I8rURuMY39Y= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Pwb67pDz; spf=pass (imf02.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727104106; 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=gjwTy2CufmK+GO1xgTXd2oAVeAy0cQHbPCXVo8T8uFE=; b=Pwb67pDzzti4bxJ4a7JQQWJudtTd84vdwDtLC2OcgE4N83mjKKkl0tZU1BmfDThxGFWTAX la4I2Va7Qgi7hssr4YTp8wEbojb3NpsqUtBBTvfby4xqMrj4wyrJ/E5BeMxMrCwQ7dkUSK CgZe5DGAQ+Am8WqRTcyIL5rjvuimGtA= 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-671-UWp1-QJNN32pkqNt_84yjg-1; Mon, 23 Sep 2024 11:08:21 -0400 X-MC-Unique: UWp1-QJNN32pkqNt_84yjg-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.17]) (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 5C48718FFACF; Mon, 23 Sep 2024 15:08:18 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.145]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 866FE19349BD; Mon, 23 Sep 2024 15:08:12 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Marc Dionne Cc: David Howells , Paulo Alcantara , Jeff Layton , Matthew Wilcox , 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, linux-kernel@vger.kernel.org, Linus Torvalds Subject: [PATCH 2/8] netfs: Drop the was_async arg from netfs_read_subreq_terminated() Date: Mon, 23 Sep 2024 16:07:46 +0100 Message-ID: <20240923150756.902363-3-dhowells@redhat.com> In-Reply-To: <20240923150756.902363-1-dhowells@redhat.com> References: <20240923150756.902363-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Queue-Id: 7C4CE80012 X-Stat-Signature: k9mg3wgrgxnumzoptmm18udfwzerqsgu X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1727104107-80476 X-HE-Meta: U2FsdGVkX186s4u7ouoOyIV/3QF2Sg41/sLrMOGnnF/855eJIF3wZBNQlQQ4tjBMDQfM83aUocGvz18qUdJzRWVbJnb2Dsx1r0SOlt98vXiQtXRBKWqeL3BpKwmDRRH/+Lz20atzYyMyNRQRTWJUJ2n9PXiVXKqX0n2U/9acZ5EYIPuJ1y7Us/Mza1fckxd6UcK29MK6s4F3GPUhKgjeiInoXW8aQMwzEzZgzMCFcrWcpPpd4ubHDri9JdtZi2Ok99WWh7J4XSOWyl717FPfokD1yA2PdKAMrAzCiuMIDS22FlwRh+hp2cJviRPhlOC+DO+SdCylsUV+Jz4zQ+yJEYZn6OtIkH6MZ1mCUQudoF5fFjm9E0sRUFL0lSptl/j2B9NML7gvAFwqgyqvbdjrDAMBzbEMffqmTNx/OnR1pbs47W+8uQcrGIyBX/SEMT50loTdoHpHKZMSW1hYmCZBQcMt3RUXD8GWNsKhOjpqflJIUtLo6V5LO6idDcz0G1FxBiWRfarKbN0EXAhY/jva//Y/NKmhBt6Kh3XGT/m+4jdz4sDzuEnXwIsJ7M7Vfhu7tKjsP8Bn86rpJ47AUeYQHDEjbrZqyt13YUADMCdpGdjAo8Pk9gVCuM3j0lzzULTWld7VQd7uZqIuMr5olNFdfM8eQglb5N33zEMaDpSRu6CdAyjhJ0FZVwSGB2touuIQWn7dnu9CfBoENQi1p3aJdBcSVyOk73xE7n7+qi2kGUPvJFd7Kh6K+UEp+bJcbUS2gD+0ZvurvKCxy47hPNQUwRzRtkWCq0v2q0yfQXITskHQOCzOn8qRr+1PMAmoxq5a24YcImCkJOOxKhOD8rd8aSXWV+iPJHUC2xEpajDHKeJuX5zmaiLqqG+SebRU7LER+vA4NXRKTBIwssDFTAQWO77udhVn9wWtvgfYkadzxzzYSk+F+4f5TMa8zW/MU7hwLodKrmOowf4N+xJpX8B +tzflqmv 2xFcjH9fqgSpeaiAQZtTUpCw3CVZbQ70jXSNEl/QPDz1LY72ogofmV3zKPXtrFDKJKgpUA8rei+uRIM9m1GEBCP1+Qo2usJgz/15BK83TSsMpSFom74VH7O5dE/LJN5N09UUnOEPTpIYCMTrJQGRH062bVAPFdJbqP0GkZsnPmsnkEfda2MP5uNBXFnX/HXhlNFcYEDdcgaOa+yL/3qL0MDiwTjWp1rOppPdipr+l7wfYWCX3sRvTWsg2spJsgzFP9QXGed0yrMi0TKa7jB/Ga4Om/bAO09aIQ81BvdDxNIJBZRSGW+3RbI5as/d9ggNocmjmNrt0R+otbiCASumpMie9LKFdv/avDrRKY+/a1y9WTKyKgwtmRH/l+y3aekiul4Ih03lQhsf8dpuxuFU0eP7k3Rf82Upj6fISbjkWNFjNzyroPqEQ6q/v8GwyL2sjlnnqcTTOcUI/4QVJVml7T/3RRTFZZzacRpWZ 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: Drop the was_async argument from netfs_read_subreq_terminated(). Almost every caller is either in process context and passes false. Some filesystems delegate the call to a workqueue to avoid doing the work in their network message queue parsing thread. The only exception is netfs_cache_read_terminated() which handles completion in the cache - which is usually a callback from the backing filesystem in softirq context, though it can be from process context if an error occurred. In this case, delegate to a workqueue. Suggested-by: Linus Torvalds Link: https://lore.kernel.org/r/CAHk-=wiVC5Cgyz6QKXFu6fTaA6h4CjexDR-OV9kL6Vo5x9v8=A@mail.gmail.com/ Signed-off-by: David Howells cc: Jeff Layton cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/9p/vfs_addr.c | 3 +- fs/afs/file.c | 15 ++++--- fs/afs/fsclient.c | 2 +- fs/afs/yfsclient.c | 2 +- fs/ceph/addr.c | 13 ++++-- fs/netfs/buffered_read.c | 16 +++---- fs/netfs/direct_read.c | 2 +- fs/netfs/internal.h | 2 +- fs/netfs/objects.c | 17 ++++++- fs/netfs/read_collect.c | 95 +++++++++++++++++----------------------- fs/netfs/read_retry.c | 2 +- fs/nfs/fscache.c | 6 ++- fs/nfs/fscache.h | 3 +- fs/smb/client/cifssmb.c | 10 +---- fs/smb/client/file.c | 3 +- fs/smb/client/smb2pdu.c | 10 +---- include/linux/netfs.h | 7 ++- 17 files changed, 101 insertions(+), 107 deletions(-) diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index 819c75233235..e4144e1a10a9 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -83,7 +83,8 @@ static void v9fs_issue_read(struct netfs_io_subrequest *subreq) if (!err) subreq->transferred += total; - netfs_read_subreq_terminated(subreq, err, false); + subreq->error = err; + netfs_read_subreq_terminated(subreq); } /** diff --git a/fs/afs/file.c b/fs/afs/file.c index 492d857a3fa0..1d30924cec5b 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -246,7 +246,8 @@ static void afs_fetch_data_notify(struct afs_operation *op) subreq->rreq->i_size = req->file_size; if (req->pos + req->actual_len >= req->file_size) __set_bit(NETFS_SREQ_HIT_EOF, &subreq->flags); - netfs_read_subreq_terminated(subreq, error, false); + subreq->error = error; + netfs_read_subreq_terminated(subreq); req->subreq = NULL; } else if (req->done) { req->done(req); @@ -301,8 +302,10 @@ int afs_fetch_data(struct afs_vnode *vnode, struct afs_read *req) op = afs_alloc_operation(req->key, vnode->volume); if (IS_ERR(op)) { - if (req->subreq) - netfs_read_subreq_terminated(req->subreq, PTR_ERR(op), false); + if (req->subreq) { + req->subreq->error = PTR_ERR(op); + netfs_read_subreq_terminated(req->subreq); + } return PTR_ERR(op); } @@ -320,8 +323,10 @@ static void afs_read_worker(struct work_struct *work) struct afs_read *fsreq; fsreq = afs_alloc_read(GFP_NOFS); - if (!fsreq) - return netfs_read_subreq_terminated(subreq, -ENOMEM, false); + if (!fsreq) { + subreq->error = -ENOMEM; + return netfs_read_subreq_terminated(subreq); + } fsreq->subreq = subreq; fsreq->pos = subreq->start + subreq->transferred; diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c index 098fa034a1cc..784f7daab112 100644 --- a/fs/afs/fsclient.c +++ b/fs/afs/fsclient.c @@ -352,7 +352,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call) ret = afs_extract_data(call, true); if (req->subreq) { req->subreq->transferred += count_before - call->iov_len; - netfs_read_subreq_progress(req->subreq, false); + netfs_read_subreq_progress(req->subreq); } if (ret < 0) return ret; diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c index 024227aba4cd..368cf277d801 100644 --- a/fs/afs/yfsclient.c +++ b/fs/afs/yfsclient.c @@ -398,7 +398,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call) ret = afs_extract_data(call, true); if (req->subreq) { req->subreq->transferred += count_before - call->iov_len; - netfs_read_subreq_progress(req->subreq, false); + netfs_read_subreq_progress(req->subreq); } if (ret < 0) return ret; diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 5d9ccda098cc..0d131101db3d 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -254,8 +254,9 @@ static void finish_netfs_read(struct ceph_osd_request *req) subreq->transferred = err; err = 0; } + subreq->error = err; trace_netfs_sreq(subreq, netfs_sreq_trace_io_progress); - netfs_read_subreq_terminated(subreq, err, false); + netfs_read_subreq_terminated(subreq); iput(req->r_inode); ceph_dec_osd_stopping_blocker(fsc->mdsc); } @@ -315,7 +316,9 @@ static bool ceph_netfs_issue_op_inline(struct netfs_io_subrequest *subreq) ceph_mdsc_put_request(req); out: - netfs_read_subreq_terminated(subreq, err, false); + subreq->error = err; + trace_netfs_sreq(subreq, netfs_sreq_trace_io_progress); + netfs_read_subreq_terminated(subreq); return true; } @@ -427,8 +430,10 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq) ceph_osdc_start_request(req->r_osdc, req); out: ceph_osdc_put_request(req); - if (err) - netfs_read_subreq_terminated(subreq, err, false); + if (err) { + subreq->error = err; + netfs_read_subreq_terminated(subreq); + } doutc(cl, "%llx.%llx result %d\n", ceph_vinop(inode), err); } diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c index c40e226053cc..518799894990 100644 --- a/fs/netfs/buffered_read.c +++ b/fs/netfs/buffered_read.c @@ -183,13 +183,12 @@ static void netfs_cache_read_terminated(void *priv, ssize_t transferred_or_error struct netfs_io_subrequest *subreq = priv; if (transferred_or_error < 0) { - netfs_read_subreq_terminated(subreq, transferred_or_error, was_async); - return; - } - - if (transferred_or_error > 0) + subreq->error = transferred_or_error; + } else { + subreq->error = 0; subreq->transferred += transferred_or_error; - netfs_read_subreq_terminated(subreq, 0, was_async); + } + schedule_work(&subreq->work); } /* @@ -295,7 +294,8 @@ static void netfs_read_to_pagecache(struct netfs_io_request *rreq) netfs_stat(&netfs_n_rh_zero); slice = netfs_prepare_read_iterator(subreq); __set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags); - netfs_read_subreq_terminated(subreq, 0, false); + subreq->error = 0; + netfs_read_subreq_terminated(subreq); goto done; } @@ -317,7 +317,7 @@ static void netfs_read_to_pagecache(struct netfs_io_request *rreq) } while (size > 0); if (atomic_dec_and_test(&rreq->nr_outstanding)) - netfs_rreq_terminated(rreq, false); + netfs_rreq_terminated(rreq); /* Defer error return as we may need to wait for outstanding I/O. */ cmpxchg(&rreq->error, 0, ret); diff --git a/fs/netfs/direct_read.c b/fs/netfs/direct_read.c index b1a66a6e6bc2..bde99fe4221b 100644 --- a/fs/netfs/direct_read.c +++ b/fs/netfs/direct_read.c @@ -100,7 +100,7 @@ static int netfs_dispatch_unbuffered_reads(struct netfs_io_request *rreq) } while (size > 0); if (atomic_dec_and_test(&rreq->nr_outstanding)) - netfs_rreq_terminated(rreq, false); + netfs_rreq_terminated(rreq); return ret; } diff --git a/fs/netfs/internal.h b/fs/netfs/internal.h index c9f0ed24cb7b..c7f23dd3556a 100644 --- a/fs/netfs/internal.h +++ b/fs/netfs/internal.h @@ -87,7 +87,7 @@ static inline void netfs_see_request(struct netfs_io_request *rreq, * read_collect.c */ void netfs_read_termination_worker(struct work_struct *work); -void netfs_rreq_terminated(struct netfs_io_request *rreq, bool was_async); +void netfs_rreq_terminated(struct netfs_io_request *rreq); /* * read_pgpriv2.c diff --git a/fs/netfs/objects.c b/fs/netfs/objects.c index 31e388ec6e48..d32964e8ca5d 100644 --- a/fs/netfs/objects.c +++ b/fs/netfs/objects.c @@ -56,7 +56,7 @@ struct netfs_io_request *netfs_alloc_request(struct address_space *mapping, origin == NETFS_READ_GAPS || origin == NETFS_READ_FOR_WRITE || origin == NETFS_DIO_READ) - INIT_WORK(&rreq->work, netfs_read_termination_worker); + INIT_WORK(&rreq->work, NULL); else INIT_WORK(&rreq->work, netfs_write_collection_worker); @@ -191,7 +191,20 @@ struct netfs_io_subrequest *netfs_alloc_subrequest(struct netfs_io_request *rreq } memset(subreq, 0, kmem_cache_size(cache)); - INIT_WORK(&subreq->work, NULL); + + switch (rreq->origin) { + case NETFS_READAHEAD: + case NETFS_READPAGE: + case NETFS_READ_GAPS: + case NETFS_READ_FOR_WRITE: + case NETFS_DIO_READ: + INIT_WORK(&subreq->work, netfs_read_subreq_termination_worker); + break; + default: + INIT_WORK(&subreq->work, NULL); + break; + } + INIT_LIST_HEAD(&subreq->rreq_link); refcount_set(&subreq->ref, 2); subreq->rreq = rreq; diff --git a/fs/netfs/read_collect.c b/fs/netfs/read_collect.c index b18c65ba5580..4ff4e520fc95 100644 --- a/fs/netfs/read_collect.c +++ b/fs/netfs/read_collect.c @@ -83,7 +83,7 @@ static void netfs_unlock_read_folio(struct netfs_io_subrequest *subreq, * Unlock any folios that are now completely read. Returns true if the * subrequest is removed from the list. */ -static bool netfs_consume_read_data(struct netfs_io_subrequest *subreq, bool was_async) +static bool netfs_consume_read_data(struct netfs_io_subrequest *subreq) { struct netfs_io_subrequest *prev, *next; struct netfs_io_request *rreq = subreq->rreq; @@ -222,8 +222,7 @@ static bool netfs_consume_read_data(struct netfs_io_subrequest *subreq, bool was subreq->curr_folioq_slot = slot; if (folioq && folioq_folio(folioq, slot)) subreq->curr_folio_order = folioq->orders[slot]; - if (!was_async) - cond_resched(); + cond_resched(); goto next_folio; } @@ -359,7 +358,7 @@ static void netfs_rreq_assess_dio(struct netfs_io_request *rreq) * Note that we're in normal kernel thread context at this point, possibly * running on a workqueue. */ -static void netfs_rreq_assess(struct netfs_io_request *rreq) +void netfs_rreq_terminated(struct netfs_io_request *rreq) { trace_netfs_rreq(rreq, netfs_rreq_trace_assess); @@ -386,56 +385,28 @@ static void netfs_rreq_assess(struct netfs_io_request *rreq) netfs_pgpriv2_write_to_the_cache(rreq); } -void netfs_read_termination_worker(struct work_struct *work) -{ - struct netfs_io_request *rreq = - container_of(work, struct netfs_io_request, work); - netfs_see_request(rreq, netfs_rreq_trace_see_work); - netfs_rreq_assess(rreq); - netfs_put_request(rreq, false, netfs_rreq_trace_put_work_complete); -} - -/* - * Handle the completion of all outstanding I/O operations on a read request. - * We inherit a ref from the caller. - */ -void netfs_rreq_terminated(struct netfs_io_request *rreq, bool was_async) -{ - if (!was_async) - return netfs_rreq_assess(rreq); - if (!work_pending(&rreq->work)) { - netfs_get_request(rreq, netfs_rreq_trace_get_work); - if (!queue_work(system_unbound_wq, &rreq->work)) - netfs_put_request(rreq, was_async, netfs_rreq_trace_put_work_nq); - } -} - /** * netfs_read_subreq_progress - Note progress of a read operation. - * @subreq: The read request that has terminated. - * @was_async: True if we're in an asynchronous context. * * This tells the read side of netfs lib that a contributory I/O operation has * made some progress and that it may be possible to unlock some folios. * * Before calling, the filesystem should update subreq->transferred to track * the amount of data copied into the output buffer. - * - * If @was_async is true, the caller might be running in softirq or interrupt - * context and we can't sleep. */ -void netfs_read_subreq_progress(struct netfs_io_subrequest *subreq, - bool was_async) +void netfs_read_subreq_progress(struct netfs_io_subrequest *subreq) { struct netfs_io_request *rreq = subreq->rreq; + might_sleep(); + trace_netfs_sreq(subreq, netfs_sreq_trace_progress); if (subreq->transferred > subreq->consumed && (rreq->origin == NETFS_READAHEAD || rreq->origin == NETFS_READPAGE || rreq->origin == NETFS_READ_FOR_WRITE)) { - netfs_consume_read_data(subreq, was_async); + netfs_consume_read_data(subreq); __clear_bit(NETFS_SREQ_NO_PROGRESS, &subreq->flags); } } @@ -444,28 +415,25 @@ EXPORT_SYMBOL(netfs_read_subreq_progress); /** * netfs_read_subreq_terminated - Note the termination of an I/O operation. * @subreq: The I/O request that has terminated. - * @error: Error code indicating type of completion. - * @was_async: The termination was asynchronous * * This tells the read helper that a contributory I/O operation has terminated, * one way or another, and that it should integrate the results. * - * The caller indicates the outcome of the operation through @error, supplying - * 0 to indicate a successful or retryable transfer (if NETFS_SREQ_NEED_RETRY - * is set) or a negative error code. The helper will look after reissuing I/O - * operations as appropriate and writing downloaded data to the cache. + * The caller indicates the outcome of the operation through @subreq->error, + * supplying 0 to indicate a successful or retryable transfer (if + * NETFS_SREQ_NEED_RETRY is set) or a negative error code. The helper will + * look after reissuing I/O operations as appropriate and writing downloaded + * data to the cache. * * Before calling, the filesystem should update subreq->transferred to track * the amount of data copied into the output buffer. - * - * If @was_async is true, the caller might be running in softirq or interrupt - * context and we can't sleep. */ -void netfs_read_subreq_terminated(struct netfs_io_subrequest *subreq, - int error, bool was_async) +void netfs_read_subreq_terminated(struct netfs_io_subrequest *subreq) { struct netfs_io_request *rreq = subreq->rreq; + might_sleep(); + switch (subreq->source) { case NETFS_READ_FROM_CACHE: netfs_stat(&netfs_n_rh_read_done); @@ -483,7 +451,7 @@ void netfs_read_subreq_terminated(struct netfs_io_subrequest *subreq, * If the read completed validly short, then we can clear the * tail before going on to unlock the folios. */ - if (error == 0 && subreq->transferred < subreq->len && + if (subreq->error == 0 && subreq->transferred < subreq->len && (test_bit(NETFS_SREQ_HIT_EOF, &subreq->flags) || test_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags))) { netfs_clear_unread(subreq); @@ -494,7 +462,7 @@ void netfs_read_subreq_terminated(struct netfs_io_subrequest *subreq, (rreq->origin == NETFS_READAHEAD || rreq->origin == NETFS_READPAGE || rreq->origin == NETFS_READ_FOR_WRITE)) { - netfs_consume_read_data(subreq, was_async); + netfs_consume_read_data(subreq); __clear_bit(NETFS_SREQ_NO_PROGRESS, &subreq->flags); } rreq->transferred += subreq->transferred; @@ -503,7 +471,7 @@ void netfs_read_subreq_terminated(struct netfs_io_subrequest *subreq, /* Deal with retry requests, short reads and errors. If we retry * but don't make progress, we abandon the attempt. */ - if (!error && subreq->transferred < subreq->len) { + if (!subreq->error && subreq->transferred < subreq->len) { if (test_bit(NETFS_SREQ_HIT_EOF, &subreq->flags)) { trace_netfs_sreq(subreq, netfs_sreq_trace_hit_eof); } else { @@ -517,16 +485,15 @@ void netfs_read_subreq_terminated(struct netfs_io_subrequest *subreq, set_bit(NETFS_RREQ_NEED_RETRY, &rreq->flags); } else { __set_bit(NETFS_SREQ_FAILED, &subreq->flags); - error = -ENODATA; + subreq->error = -ENODATA; } } } - subreq->error = error; trace_netfs_sreq(subreq, netfs_sreq_trace_terminated); - if (unlikely(error < 0)) { - trace_netfs_failure(rreq, subreq, error, netfs_fail_read); + if (unlikely(subreq->error < 0)) { + trace_netfs_failure(rreq, subreq, subreq->error, netfs_fail_read); if (subreq->source == NETFS_READ_FROM_CACHE) { netfs_stat(&netfs_n_rh_read_failed); } else { @@ -537,8 +504,24 @@ void netfs_read_subreq_terminated(struct netfs_io_subrequest *subreq, } if (atomic_dec_and_test(&rreq->nr_outstanding)) - netfs_rreq_terminated(rreq, was_async); + netfs_rreq_terminated(rreq); - netfs_put_subrequest(subreq, was_async, netfs_sreq_trace_put_terminated); + netfs_put_subrequest(subreq, false, netfs_sreq_trace_put_terminated); } EXPORT_SYMBOL(netfs_read_subreq_terminated); + +/** + * netfs_read_subreq_termination_worker - Workqueue helper for read termination + * @work: The subreq->work in the I/O request that has been terminated. + * + * Helper function to jump to netfs_read_subreq_terminated() from the + * subrequest work item. + */ +void netfs_read_subreq_termination_worker(struct work_struct *work) +{ + struct netfs_io_subrequest *subreq = + container_of(work, struct netfs_io_subrequest, work); + + netfs_read_subreq_terminated(subreq); +} +EXPORT_SYMBOL(netfs_read_subreq_termination_worker); diff --git a/fs/netfs/read_retry.c b/fs/netfs/read_retry.c index 0350592ea804..3f29e823d379 100644 --- a/fs/netfs/read_retry.c +++ b/fs/netfs/read_retry.c @@ -232,7 +232,7 @@ void netfs_retry_reads(struct netfs_io_request *rreq) netfs_retry_read_subrequests(rreq); if (atomic_dec_and_test(&rreq->nr_outstanding)) - netfs_rreq_terminated(rreq, false); + netfs_rreq_terminated(rreq); } /* diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c index 810269ee0a50..2f3c4f773d73 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c @@ -307,8 +307,10 @@ static void nfs_netfs_issue_read(struct netfs_io_subrequest *sreq) &nfs_async_read_completion_ops); netfs = nfs_netfs_alloc(sreq); - if (!netfs) - return netfs_read_subreq_terminated(sreq, -ENOMEM, false); + if (!netfs) { + sreq->error = -ENOMEM; + return netfs_read_subreq_terminated(sreq); + } pgio.pg_netfs = netfs; /* used in completion */ diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h index 772d485e96d3..9d86868f4998 100644 --- a/fs/nfs/fscache.h +++ b/fs/nfs/fscache.h @@ -74,7 +74,8 @@ static inline void nfs_netfs_put(struct nfs_netfs_io_data *netfs) */ netfs->sreq->transferred = min_t(s64, netfs->sreq->len, atomic64_read(&netfs->transferred)); - netfs_read_subreq_terminated(netfs->sreq, netfs->error, false); + netfs->sreq->error = netfs->error; + netfs_read_subreq_terminated(netfs->sreq); kfree(netfs); } static inline void nfs_netfs_inode_init(struct nfs_inode *nfsi) diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c index 131f20b91c3e..1f27847350cf 100644 --- a/fs/smb/client/cifssmb.c +++ b/fs/smb/client/cifssmb.c @@ -1261,14 +1261,6 @@ CIFS_open(const unsigned int xid, struct cifs_open_parms *oparms, int *oplock, return rc; } -static void cifs_readv_worker(struct work_struct *work) -{ - struct cifs_io_subrequest *rdata = - container_of(work, struct cifs_io_subrequest, subreq.work); - - netfs_read_subreq_terminated(&rdata->subreq, rdata->result, false); -} - static void cifs_readv_callback(struct mid_q_entry *mid) { @@ -1334,8 +1326,8 @@ cifs_readv_callback(struct mid_q_entry *mid) } rdata->credits.value = 0; + rdata->subreq.error = rdata->result; rdata->subreq.transferred += rdata->got_bytes; - INIT_WORK(&rdata->subreq.work, cifs_readv_worker); queue_work(cifsiod_wq, &rdata->subreq.work); release_mid(mid); add_credits(server, &credits, 0); diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index 78b59c4ef3ce..fb8e12c3c37c 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -227,7 +227,8 @@ static void cifs_issue_read(struct netfs_io_subrequest *subreq) return; failed: - netfs_read_subreq_terminated(subreq, rc, false); + subreq->error = rc; + netfs_read_subreq_terminated(subreq); } /* diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 2cb1bf65a172..0b63608aeecb 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -4494,14 +4494,6 @@ 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_read_subreq_terminated(&rdata->subreq, rdata->result, false); -} - static void smb2_readv_callback(struct mid_q_entry *mid) { @@ -4614,9 +4606,9 @@ smb2_readv_callback(struct mid_q_entry *mid) server->credits, server->in_flight, 0, cifs_trace_rw_credits_read_response_clear); rdata->credits.value = 0; + rdata->subreq.error = rdata->result; rdata->subreq.transferred += rdata->got_bytes; trace_netfs_sreq(&rdata->subreq, netfs_sreq_trace_io_progress); - INIT_WORK(&rdata->subreq.work, smb2_readv_worker); queue_work(cifsiod_wq, &rdata->subreq.work); release_mid(mid); trace_smb3_rw_credits(rreq_debug_id, subreq_debug_index, 0, diff --git a/include/linux/netfs.h b/include/linux/netfs.h index 5eaceef41e6c..d1f96b057b8f 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -429,10 +429,9 @@ bool netfs_release_folio(struct folio *folio, gfp_t gfp); vm_fault_t netfs_page_mkwrite(struct vm_fault *vmf, struct netfs_group *netfs_group); /* (Sub)request management API. */ -void netfs_read_subreq_progress(struct netfs_io_subrequest *subreq, - bool was_async); -void netfs_read_subreq_terminated(struct netfs_io_subrequest *subreq, - int error, bool was_async); +void netfs_read_subreq_progress(struct netfs_io_subrequest *subreq); +void netfs_read_subreq_terminated(struct netfs_io_subrequest *subreq); +void netfs_read_subreq_termination_worker(struct work_struct *work); void netfs_get_subrequest(struct netfs_io_subrequest *subreq, enum netfs_sreq_ref_trace what); void netfs_put_subrequest(struct netfs_io_subrequest *subreq, From patchwork Mon Sep 23 15:07:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13809702 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 599ADCF9C72 for ; Mon, 23 Sep 2024 15:08:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF6346B008C; Mon, 23 Sep 2024 11:08:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA61D6B0092; Mon, 23 Sep 2024 11:08:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6D686B0093; Mon, 23 Sep 2024 11:08:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A4D016B008C for ; Mon, 23 Sep 2024 11:08:44 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 376FD121358 for ; Mon, 23 Sep 2024 15:08:44 +0000 (UTC) X-FDA: 82596334968.12.0A7FFF5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 78FA91C0023 for ; Mon, 23 Sep 2024 15:08:41 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=iSdFVGDI; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.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=1727104034; a=rsa-sha256; cv=none; b=3fZ9qWrasEhvPyGUEmZF3p2pFBlCf32xIHddCRae1oYj5Z/By0b9T5iATLHtucWjODFALX t1/I0efn4s3KczmeSKJYkgs2W8s1a+T3VRHdyvXELqRrmyk8mRIoX1Tuk7+VbvkmenAAvK AVVYo46gJPXUaKtGIbsiBkpAjZfMQyA= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=iSdFVGDI; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.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=1727104034; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7sJs50CQB1rXW7Czy4aIaKRpcUNrb/d4a0miNhatVWk=; b=PeoCevdEjCHu8BIokm1FETh/nu3gCVRAB/hbHOd7pSB1SckVTJHaQVSCS4ylXRqIqdIBm/ 4B8CP1ZCcySorHXFvoBEbXazOlIIQO+/BALNHotjw19FlrhtsM197dqXrI8YrwtbKwZSv1 ZWlx/uiCPa425+pkO9jzCFDegVg6BU0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727104120; 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=7sJs50CQB1rXW7Czy4aIaKRpcUNrb/d4a0miNhatVWk=; b=iSdFVGDIq+JGumIh5MtRiv5vZIUpNnW6TcvSsni3NVx005szsyfEjTzHdQJG+PFPkuRtf5 XdNlpoW+iRf4NB8XsvBc5INbj9csVpcQQRwX//TjAcLjroiGvjNJtCJXFe9UX1fBA0SehS 6KcqbhqnOK+5DWcByUZG3vNITeTgJnI= Received: from mx-prod-mc-01.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-74-MvVAiCEgPwSeBw7yfVwWvA-1; Mon, 23 Sep 2024 11:08:39 -0400 X-MC-Unique: MvVAiCEgPwSeBw7yfVwWvA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.12]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E4E23195FE03; Mon, 23 Sep 2024 15:08:36 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.145]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C252F1954190; Mon, 23 Sep 2024 15:08:18 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Marc Dionne Cc: David Howells , Paulo Alcantara , Jeff Layton , Matthew Wilcox , 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, linux-kernel@vger.kernel.org, "Dr. David Alan Gilbert" Subject: [PATCH 3/8] afs: Fix missing wire-up of afs_retry_request() Date: Mon, 23 Sep 2024 16:07:47 +0100 Message-ID: <20240923150756.902363-4-dhowells@redhat.com> In-Reply-To: <20240923150756.902363-1-dhowells@redhat.com> References: <20240923150756.902363-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspamd-Queue-Id: 78FA91C0023 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 4k8iaef4o1hsuuym4yg3xrku437mgaxz X-HE-Tag: 1727104121-114289 X-HE-Meta: U2FsdGVkX1/KHpsUymO8KSL8r2UWvjkyy7gP2gqYCl05Fs6EClfWyR3NOQWUeLrwQJNNhKDJJmzB6pYJVT21QGXcF0fR6Q6HwMLF7gBJUct0mIwUSR6tVuCZfCevuytVbHz8pNNHbF8zvLM37GQ1LghDZNe1qdJ1f3ZG0mNAvX8cQZsZn4FdPjZE3cgRVXJB3jtfzsjMfIfILBAg8GxHo9uDXc15fbZST91iHBnpdaLsgYD9bxus8Tq/lPuIsbITuflqEBOcQFXM5TFEhEHRoCxlKh3FIcSvCmiT2XGGnpYfwqXF45vNZQPSX65L2D6BdQ2+b3voyi/qjGJUvqwxyOBCnt55gPuXz05ANXPRalBxgp7tRzxCqOKDTQFdDm//sWGZahahuoiOp8SHBNbph2FDpHuKWHsVCKgROtCJSbD0xDDQknqp3ciDYB2fpwElY2cxdvhEDvOZQkM2naYcnVcaFgyp4qUbe2E9PZu57jD3uWeorPmnsv5USRPu/zJcCUmiVr3vBD7f7K50sYpSYHhrwVIOAg/45e9ELQevt1ytCNp3HYdIpxNdm8hvdM+2oPw4ke8URkPgxJraixHUkpXGcAYIXfQ5mGpsDH2TrLnWfh3NsJazsd81MK29J5/7J9wzmjxTmSVAr0jsD5d5kPlRWdMTXH4jcHcht+LV9f0HVnP/fpjHjQD8wm/UFJ6tXOeCfRktOrGFGr4s1IxzMpiHUrNvT/UCDUzo86Q/nIZ4KIkwCa5BwQAUF0i0PUyxKyOyU1YX/r5rIkIsgdOUiAG53zCkj5HWCXk/708khF/AbDDWyd2DX50DGYeL1O8wKWc3iCEfVhrRjROzIpQJqZeH1Gap7TE8PXLblQGKhBuPOgZLDbyuyQALMph8eh0mAn/Z91hA916gUrRhonrW1W1nrLF3wZkfPN670vtkx0yHHkS4gnHBn1MeEIfU3FCTQE/EhTisRaur005MKKm rj3bc+Ls rOJ524aEG7ziDmPiQqC1DUSSgNcBM/YJTdtz14P3p1yv4UaviHkbia0ng6z5Y4ozE/wzse+cSNA1i0l0HPUaTnOufKYYr6/P7MJn/2i2iJzjzcDsIC6YMKbdyqyo5LCNr5g1JY1Yiz6+nRZ0fcGFZXOQGsy+yMtcqV64SmljD9ydFTx6jvNE/BMs+zRvyKghYIKA6DcmsKFqE384fum09IEq5B+Ii9YA6dFdo6FUtyyPM7PVr9yN48OnJy4CHnjbVPAejcw4gVUtf2L0FSveRBjbb4JRrcDnob99nxS+4RNGGc5wHVW6KGzRm5kvaUIIBbjpo0IzwQxuuONZu98P+gmFN5i0lj+VwS41/7J9XhjVnR2cSvW8FDIzOUyWj/FuT2/JrrzYEjKrw4ciGnUxh5dOLneZ7ereSnE4ffAVjwVVl39NMQLr2xoodDn4zy3bSLlfFcy8hxiimelSufE7IyjOtDWAmv4NPcjhAaifiRCCwJBLF5zBCPFd5BINdFCsWGgH91Ict31r+pgp5bZbYyYNuDTUKACNPxjtRv0IdW6voI+CKjRGT1SzAg3SCbUSkJKa5 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: afs_retry_request() is supposed to be pointed to by the afs_req_ops netfs operations table, but the pointer got lost somewhere. The function is used during writeback to rotate through the authentication keys that were in force when the file was modified locally. Fix this by adding the pointer to the function. Fixes: 1ecb146f7cd8 ("netfs, afs: Use writeback retry to deal with alternate keys") Reported-by: "Dr. David Alan Gilbert" Signed-off-by: David Howells cc: Marc Dionne cc: Jeff Layton cc: linux-afs@lists.infradead.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/afs/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/afs/file.c b/fs/afs/file.c index 1d30924cec5b..f717168da4ab 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -425,6 +425,7 @@ const struct netfs_request_ops afs_req_ops = { .begin_writeback = afs_begin_writeback, .prepare_write = afs_prepare_write, .issue_write = afs_issue_write, + .retry_request = afs_retry_request, }; static void afs_add_open_mmap(struct afs_vnode *vnode) From patchwork Mon Sep 23 15:07:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13809704 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 15474CF9C74 for ; Mon, 23 Sep 2024 15:08:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 963366B0096; Mon, 23 Sep 2024 11:08:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 916286B0098; Mon, 23 Sep 2024 11:08:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78CE16B0099; Mon, 23 Sep 2024 11:08:50 -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 535126B0096 for ; Mon, 23 Sep 2024 11:08:50 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 07CA01413BA for ; Mon, 23 Sep 2024 15:08:50 +0000 (UTC) X-FDA: 82596335220.08.0CB92B8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 383EE4002C for ; Mon, 23 Sep 2024 15:08:48 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="PTVKvKy/"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727104032; a=rsa-sha256; cv=none; b=2G/bsIchcuUlr9r+E4el5rSWsu7JFu+toUuF579JFdDLh5dRb9C+ffd0Dfx2dXDt2s8yVd HteGk61m5jc7i3ALRUihhqtoHt4I/Ys/gDPfDZIq7YTW0zSdBVGqb0YjzxeyJLMWLxkGbh gAOZVgNTb8Cctw4JvqkVdqz+U04e1r4= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="PTVKvKy/"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1727104032; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YHIPIQ0jqmx06tKWg5zwKCYYjtifDx3/S1TSTB/jDJ4=; b=5cBhRrB0upVVLrzCGvOQhXca1cXhzdcEshZLMTyrNFWUFXwKWjOubsHJwvH19CEIjzQHYW Vy5KrvkYV95u04OxV7M5G4G+sJUpWFj7C9ZFrQYr1V+2Q2hVG46eMyGLQrqFyNELJBrdI5 0V22OX/+epsJnAD6yEJDDSM4JNStUrg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727104127; 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=YHIPIQ0jqmx06tKWg5zwKCYYjtifDx3/S1TSTB/jDJ4=; b=PTVKvKy/OpXZy1JmwaKJStZ5BwY/sgZfb9V5qjumC+l/bNLmBbgBAkdVKz9VIzLjiCG7da EgzBXUsFJGG3m1X4aiXC8RQHwOIxUbrLHha6iwbdNQSMkSA1wmC2H4Si+DPfvghtQ43fek JyrpA5JpW8LP4ZPolkB0F3uoCrO5mGk= Received: from mx-prod-mc-02.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-645-n60o72YoO8em_juxYjNDxw-1; Mon, 23 Sep 2024 11:08:42 -0400 X-MC-Unique: n60o72YoO8em_juxYjNDxw-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.40]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 633B218B6A33; Mon, 23 Sep 2024 15:08:39 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.145]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2387B190AABA; Mon, 23 Sep 2024 15:08:24 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Marc Dionne Cc: David Howells , Paulo Alcantara , Jeff Layton , Matthew Wilcox , 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, linux-kernel@vger.kernel.org, Thorsten Blum Subject: [PATCH 4/8] afs: Remove unused struct and function prototype Date: Mon, 23 Sep 2024 16:07:48 +0100 Message-ID: <20240923150756.902363-5-dhowells@redhat.com> In-Reply-To: <20240923150756.902363-1-dhowells@redhat.com> References: <20240923150756.902363-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 383EE4002C X-Stat-Signature: noy3ha6i1u4xw97quz3u6busp48oapq7 X-Rspam-User: X-HE-Tag: 1727104128-76701 X-HE-Meta: U2FsdGVkX1/0nZotUk6czl216kypem7fPy7VHU9tVd+HshEpsuK5HnhC2zGjup+ao73+wEEINMco3q7pzbrkJX4mvvX4KTnbfM1WFXqey9f1pVaVufqQDO3725a4s5ciCyUSFUDYuZJVtj5RLQFxrRFu5HBFBlv28vdflhb8I5WdUPh7wCsUwgOoIox1ooYeeM9Q95HC178aPfM+YMorR+q6jkHexoNsTKFmSgbNooj+EMaIWCbXdYxstRhxxogXesGNOH0EljzsoJnWv/3JkLApOvJQHJM87re2Ydqba8AXpMbHN1GBzNoRXxAphcVhiga3AAMVA5rNfZvDqDbvcsJYVkikmNTzsTweovrOjAW1yJoqwoihqmBNwmqg8syDoUpOdY2KNVPcdHcyzyDVXI/L9BheYGS2CvJkUrjelyVepsHmyB5lwLt2kj4lsKJRACo92mFh528DEMALR+YIvb1R9n3OxTkWeWB+7hZDERCbtVCMiaUPpLY6Yabi0TqLQ/5ZcD8SqsKo4L9uL/UHrtqwfcKe0L6FvVY00zOIIU/3NJgsiRTyEi4MCDM05dKl8GE8OwmMr7iAmLqMwY41m1Cy+70d8F49S2QfPu/Oi3W8iC1HLq6Mgn7OsSadTfsGQVFUsI7MR3yGHpiuALR++LLVsre1RP/ZojBLa70P9PiQDWL8bdlEgblPf3pI/9vFkm3suw9CWr162sQJ8v3Xwpn4LS6ZeMkWYM+czDa2H51LsE9QYdQdxT9ZxA23DGDpfmoRwPZSoK1LujpM5+mqqmvtufpTPgjPR7qP06cI7FCSDh03GqlPK5+ho8iX0aXlYu+cGmZd5h5SyUXwb1uSYsRMIHgNt3jlznk+fic9lAXnybdmlwz+kX2sXFkuW1gU8pQwN7UvVWJTHtsKQE04ALOVfgod0vFdyLNBnyMRhBJmyqcv171fsveVHQZkTHf/eBAQeELpmh/ky7vkB3y YiGtaoit RHIAJf/hWF01+kxo/xB+bb+E+//H6f0MJJ2FsiDo+P9yQCMvybFcE0lrxyMBsknXQZNqkzbQoTjoaYhkBHR7B+aHSA8oU/frlDT2lZ35aDgMptV1bD5s0NQE76szpXqbdBEWGIAYqlF/AaafIa2iNDkvkQmLtzKsP+/ttJrH+KFkR1zGd2zfw2c7sv1r8usIM6kretUOu2JKC9rTE2gBZSpJ0uQsG6i5R0hOn21uaG3RbFNA/KNrj/H9ZEm1c85VeVU5dX5ZGw6Bk38hoKTTFuoZPcqAnFcasBIut6qcGqJQglJZOULBFMxfacgpjwofO3kNZ9sbGHFNNXemq9KgBlBAPoOSdvBJhadu8DkxZOXqBGrDcBWQ4MK/zZzMpld1HYAoDdpfyzyofz2OocAfpd4pabDIE0ZwVzRrNTzPFer+LVZB/5V7gTGa+lXTWJK7nEfAAT7Mn2SpHXZlI4XIf3EN7g+SgmS4QmNsP24+zMcIjdeaa9PHMlN52lq421u7xBkJVcvtAO0U+hvZBzl90AOUTig== 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: From: Thorsten Blum The struct afs_address_list and the function prototype afs_put_address_list() are not used anymore and can be removed. Remove them. Signed-off-by: Thorsten Blum Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org cc: linux-fsdevel@vger.kernel.org Link: https://lore.kernel.org/r/20240911095046.3749-2-thorsten.blum@toblux.com/ --- fs/afs/afs_vl.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/fs/afs/afs_vl.h b/fs/afs/afs_vl.h index 9c65ffb8a523..a06296c8827d 100644 --- a/fs/afs/afs_vl.h +++ b/fs/afs/afs_vl.h @@ -134,13 +134,4 @@ struct afs_uvldbentry__xdr { __be32 spares9; }; -struct afs_address_list { - refcount_t usage; - unsigned int version; - unsigned int nr_addrs; - struct sockaddr_rxrpc addrs[]; -}; - -extern void afs_put_address_list(struct afs_address_list *alist); - #endif /* AFS_VL_H */ From patchwork Mon Sep 23 15:07:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13809703 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 514B1CF9C6F for ; Mon, 23 Sep 2024 15:08:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D32906B0093; Mon, 23 Sep 2024 11:08:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CE2986B0095; Mon, 23 Sep 2024 11:08:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BAA416B0096; Mon, 23 Sep 2024 11:08:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9A75C6B0093 for ; Mon, 23 Sep 2024 11:08:48 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 5C051A130E for ; Mon, 23 Sep 2024 15:08:48 +0000 (UTC) X-FDA: 82596335136.26.04325CA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 88CF48000F for ; Mon, 23 Sep 2024 15:08:46 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M6Pu8LUS; spf=pass (imf02.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727104008; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3lKiHWTaBx3zx8IjGF1i+IbwHetAMo/Hx9i4LC4nBI4=; b=UqOV56ZCqdZ1+PZqjswKc49nN0dZRBzGgh6zh3ilj60InsHtmCvWG6skyunNvtjT8yb80Z XcOYVnmsoaVNChlm5Mm/Ds+iUwGkxpwWHinuYvq7POLzX3PvkGR+d/kvXiOsDzXx5FRr0B 4dFWPJoIBFVE3AAo8RGjkjLTurcXjjs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727104008; a=rsa-sha256; cv=none; b=JF0zG7MAtoyqu1+sPhsTVbYVnMfQB8c2HRAoNy69tLsdMtLfOd7jce+eyJII9So6YQVOSM mO3woyavkA2fyD7DYvAn04vELw3LB30u1eDiKJsBuMEdp+WfosgCSsM1oyrsG0RRFz9Tjk vp9jQWVsMo+un6iIKEqzMbTYOuffkVo= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M6Pu8LUS; spf=pass (imf02.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727104125; 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=3lKiHWTaBx3zx8IjGF1i+IbwHetAMo/Hx9i4LC4nBI4=; b=M6Pu8LUS4dpTizbo8NZhOHTAYwuGlZRWIQ5KyIFerAV17DD/Oc27sDcBPRXz4SkH4xhgcj zMU/20AnyHKHSFLeSUjtDZoWgI26mhZw4VQy91p2TMeJ83hi1bs7s5UgBh3iIbmjknzRoJ ZyZGMh3Q2KCtie38V2rXCx10RkzXLas= Received: from mx-prod-mc-02.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-633-Odl9lH7FPeeRz2-0q0JfvA-1; Mon, 23 Sep 2024 11:08:42 -0400 X-MC-Unique: Odl9lH7FPeeRz2-0q0JfvA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.17]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 059CD18BC605; Mon, 23 Sep 2024 15:08:40 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.145]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 51FD51977026; Mon, 23 Sep 2024 15:08:31 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Marc Dionne Cc: David Howells , Paulo Alcantara , Jeff Layton , Matthew Wilcox , 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, linux-kernel@vger.kernel.org, Markus Suvanto Subject: [PATCH 5/8] afs: Fix possible infinite loop with unresponsive servers Date: Mon, 23 Sep 2024 16:07:49 +0100 Message-ID: <20240923150756.902363-6-dhowells@redhat.com> In-Reply-To: <20240923150756.902363-1-dhowells@redhat.com> References: <20240923150756.902363-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Stat-Signature: xm9bwp78j8wcyh4am4dhgzc5cxmdkaep X-Rspamd-Queue-Id: 88CF48000F X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1727104126-878993 X-HE-Meta: U2FsdGVkX1+6etF9T3oR4dzHfUPTzNYZFSFaxOgrK7pQPPgBISu6+x4I+1d0bqw2JNcL4sN1852njhJ/JfoRqdCM/c7B3iJjYnHkh8ws+U0UOj2k7Rt/5AGYqFLFRKNUlQaAny5ZM8ZlsFAneRlRR4BExsKEpo58wEBRyHv0qXDVs/OVyn6gR3+HFGZJ6L2VU8c3i/JOZYp1w14fwpZMID4sJL+U65ka819epqsomuUQOtmKiegY4fSIm96eoruYgaOTckXn9xDBVg3aLsR+d63fMJOS1ldLFQkj+KxyE7LOiLN76wYOcVJjpkDaWRpFrVttn/flxqrsUNGee1uNumknLLGC1Cc/aI3RZxTjT/YeLSaPssMamPS4ty1KyXWN9aQLCDSExM38k8NSwYN0vUkrl3hmyDUKhdZ5YatI9YHUDC5eNUC0LMzjV+9FPyj4NYjpQxg6ktFNzFDo1frbsV6RsCzeq4s0uizEMkXqLm7Nv6RF3TDKs4AGxzBstkyxFhIalOf8MpFwtvbZB/GpqEBYyCnrCObIpATHVB1cqrysV2FeZ2a3TePc6ynwbXE9hKcVmcA1ZVtTVbHneGYdaq73r0J+VI12RWA3+xzoKuM6IyvjD0FSNT7v3YIqqW8s2iPVsXlgj2A5FPtVS1h1WcT1XIi5q8zK1X+yVITs7DI0LRZGpXHntCEGy+hkT5/91nt4L5ADt6dp3ZvGZsK/tQ5Ek5iVMH5i/g3suj0zUOuGDkjkIDGAlrGhuJMaMnZ211BZjpc+q6kOMwVRLkzR6tBhjX88uB2oa7ruCMTf7gsYmXjuSqeacTl1XRQ9UtfzajCU4kdvfZfFv4clvp9BhWJCWZSDv4+TMZPmbVHOd8uTWLHy3JHmqpJLvy8YDJZNX5r15fKTBc/FlZ9WmRvvtQVasgOvo5pS34TOKCTdl+oqd2J/b6i3lB29sa6dAq2653uvS1tR0VgN0/tS+Fw eTyjGlGc t4hxq45LPOJHvtLUHiZy8MwoVEWjcJgMRmel9CzQqApB4TjlisXArnAHHOqCUGJkVI6ocHr1ngGGycrPhSHNZ+g6DvtGP9vKjM1do5OfsKuI4Sl9LwrvOjkIZTo9UKuIbSODfm3J+o3l1n0YutIYgSjlEo1BSRVNj2+sgj+m+rGjl9k4Jt4Ch88jFXsR2fBCVigb69Lb6qnkfKNp+BNt8GrFvedVNGre3xTBhixzuYkGdFNA952g9JbUjpfsXgQTjFVfoYvUnm1HB9Sl77CPCGFBvwCMW9ci7flyf4FH7kRLC6+mNND9wb897OulyzExl+HUDqu1Fvb5tfu3wKWCwnq9K4QcYKBce6AHCZfQW5xLkmkvYvHoqOR9aCTce10ubhzwuszku7ZNw3LZ1mLwKBpJgDIqhkkm0Tr95YfQLxbJEKjUY85Igcn7ZZ3DVvAeFc5Tap+JrfDyNWy1CbPsA5xQKVKqpK5MmUAY/TLL57UZXHzTq7QwosBpWDZNnG1pt+W7dM82ttxDPWLUfQHHQfZfUSiKX+RxzQ1oac1dyAohiIe1YUL8l2Ob9XQ+4bj3+q4dl1/xoh71iekM= 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: From: Marc Dionne A return code of 0 from afs_wait_for_one_fs_probe is an indication that the endpoint state attached to the operation is stale and has been superseded. In that case the iteration needs to be restarted so that the newer probe result state gets used. Failure to do so can result in an tight infinite loop around the iterate_address label, where all addresses are thought to be responsive and have been tried, with nothing to refresh the endpoint state. Fixes: 495f2ae9e355 ("afs: Fix fileserver rotation") Reported-by: Markus Suvanto Link: https://lists.infradead.org/pipermail/linux-afs/2024-July/008628.html cc: linux-afs@lists.infradead.org Signed-off-by: Marc Dionne Signed-off-by: David Howells Link: https://lore.kernel.org/r/20240906134019.131553-1-marc.dionne@auristor.com/ --- fs/afs/fs_probe.c | 4 ++-- fs/afs/rotate.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/afs/fs_probe.c b/fs/afs/fs_probe.c index 580de4adaaf6..b516d05b0fef 100644 --- a/fs/afs/fs_probe.c +++ b/fs/afs/fs_probe.c @@ -506,10 +506,10 @@ int afs_wait_for_one_fs_probe(struct afs_server *server, struct afs_endpoint_sta finish_wait(&server->probe_wq, &wait); dont_wait: - if (estate->responsive_set & ~exclude) - return 1; if (test_bit(AFS_ESTATE_SUPERSEDED, &estate->flags)) return 0; + if (estate->responsive_set & ~exclude) + return 1; if (is_intr && signal_pending(current)) return -ERESTARTSYS; if (timo == 0) diff --git a/fs/afs/rotate.c b/fs/afs/rotate.c index ed09d4d4c211..d612983d6f38 100644 --- a/fs/afs/rotate.c +++ b/fs/afs/rotate.c @@ -632,8 +632,10 @@ bool afs_select_fileserver(struct afs_operation *op) wait_for_more_probe_results: error = afs_wait_for_one_fs_probe(op->server, op->estate, op->addr_tried, !(op->flags & AFS_OPERATION_UNINTR)); - if (!error) + if (error == 1) goto iterate_address; + if (!error) + goto restart_from_beginning; /* We've now had a failure to respond on all of a server's addresses - * immediately probe them again and consider retrying the server. @@ -644,10 +646,13 @@ bool afs_select_fileserver(struct afs_operation *op) error = afs_wait_for_one_fs_probe(op->server, op->estate, op->addr_tried, !(op->flags & AFS_OPERATION_UNINTR)); switch (error) { - case 0: + case 1: op->flags &= ~AFS_OPERATION_RETRY_SERVER; - trace_afs_rotate(op, afs_rotate_trace_retry_server, 0); + trace_afs_rotate(op, afs_rotate_trace_retry_server, 1); goto retry_server; + case 0: + trace_afs_rotate(op, afs_rotate_trace_retry_server, 0); + goto restart_from_beginning; case -ERESTARTSYS: afs_op_set_error(op, error); goto failed; From patchwork Mon Sep 23 15:07:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13809705 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 C6165CF9C6F for ; Mon, 23 Sep 2024 15:09:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 592626B009A; Mon, 23 Sep 2024 11:09:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54E996B009C; Mon, 23 Sep 2024 11:09:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BAA56B009B; Mon, 23 Sep 2024 11:09:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1BB856B0099 for ; Mon, 23 Sep 2024 11:09:02 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id AC89F813CB for ; Mon, 23 Sep 2024 15:09:01 +0000 (UTC) X-FDA: 82596335682.15.448020E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf16.hostedemail.com (Postfix) with ESMTP id DC13B180017 for ; Mon, 23 Sep 2024 15:08:59 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Tc6i0D6f; spf=pass (imf16.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727103983; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Z8v23aDW/AqUoLZapyyeRQboTKixFXScSQEzJQ0mhVc=; b=6SDMvDgUGZstBYqc03Sjw2eTKqXuDETorYa2RHbMhJ8/J1M/TCZ4jfXd8bpmYfDYLDkfzL YUEVCRQwVkZ/kAbmzU4c0Qbuy9AYGKvJS6YGtzT4nKA+5GO6+Ib2mCqVAYbYLFCLCwIAc2 czYI4diq5gA2wgjMSriRaCzs/n23lnw= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Tc6i0D6f; spf=pass (imf16.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727103983; a=rsa-sha256; cv=none; b=vdWcc/+rCwaRbzx0qTKCF50iCEojOUvZNGn8y9LT6tNCAap5R09hQnxJeReoLmdUrKkNAN +N52YimdOYlrAekDeBW247QRxF5xraA/6M4OgNzmYlYH1gSUxRb96N6nSyEffPIFM5XCu/ Z7+NMefSsP0T9+g02ybB72wgx4FiW/s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727104139; 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=Z8v23aDW/AqUoLZapyyeRQboTKixFXScSQEzJQ0mhVc=; b=Tc6i0D6fmvustL66frg53LvbW7Z4gky+jOGR55GwhxYFhAF9hjX1hrsAfxyjRe/6F0v7Ki k5FKgz3Fgtm5H3DZrUnCmmXpyLCfK9C3zbJXP8hJvSdu2MBu4atXP2rRd14NOXWf9Bo8nA UwxsUXwmIrzaHL9L7KhL0g6y/s0stTs= Received: from mx-prod-mc-03.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-551-DYyLGeXsPkSx-Jt_v0ORCQ-1; Mon, 23 Sep 2024 11:08:53 -0400 X-MC-Unique: DYyLGeXsPkSx-Jt_v0ORCQ-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.17]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AAD5618B63DB; Mon, 23 Sep 2024 15:08:49 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.145]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C923A1934989; Mon, 23 Sep 2024 15:08:36 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Marc Dionne Cc: David Howells , Paulo Alcantara , Jeff Layton , Matthew Wilcox , 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, linux-kernel@vger.kernel.org Subject: [PATCH 6/8] afs: Fix the setting of the server responding flag Date: Mon, 23 Sep 2024 16:07:50 +0100 Message-ID: <20240923150756.902363-7-dhowells@redhat.com> In-Reply-To: <20240923150756.902363-1-dhowells@redhat.com> References: <20240923150756.902363-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: DC13B180017 X-Stat-Signature: irqmqo6eqd5k3f85zwyoop7yt5pqazqy X-Rspam-User: X-HE-Tag: 1727104139-50859 X-HE-Meta: U2FsdGVkX19mahod64QyrFyixRzQfL+HoCSZPSGgT7cxa9GeI/v2FgAKklxiV2grpOr5dMZIIVEeAuo/At/dDx1vSgRbL4azkPnAnsjydDaDbxCqDAVzIg8noZWJo5qtXIo4DJU0yFi0YuXr2loE3LWogGmSVvzQf0r9K7vTq5dM6miTUAsdQnNfX9PE8mreHYZGKW41N3ohwsYTqsGgu6dAca1WNn8ffKz1zhidjKdoBO/EgBLvI+/Lqjr2RbFjZLb570wMXRVUu1gNHH4mw41VUPMMEAOAmpC65uJ0LGnQaVcNobRanZhtzJiK6ERlqBS9NsVK2tXHw4y9h1mkmxqTIWl+S3VktB8MCiul2oz4q+XSfo5oxQayZ4EEEGzTtDxcrWT3S3vLp2jLCh9QeK42cL1DqCMAyEvBdbCOV5vbWE2+TCauXRdLA36BUt2qidcyaR6Gp9ViE+/gsDNyOiFg3uGbVkZAgbxdB/ozVdPYOUuyMimQlsdTCEj7g2sAtHsLkcQm3NjVwhFx5DEjOgYu7avBS6aa/4TVd02427hh9MJa3Hx84lQABsdl9LO8N9hg0NG6P2p8ffEf1VtU5fpzIt58wjPb8iKc8csaArdb7uWSj/U2XXA0ZGHUwA+pN+ebrEBErr6j+ZI65V3SlC5DSVa4j3iKkc5cXusGfG2JEzisQwyuU85XDg7fbq4I0gC/4T6sTW+hD2sp32lpWI/oVM/IBNP8fK39Ig+MNzroVFoy5U8CUmX+wJiTd0rNnmcWLGJpZ4fw9MG7ceGEF48ea8+7HEoSUKNNDO7ky+AzIWPwx0D3r8ErplYSCr5jHcqt6v3SDL/fgPkIaCay52KEQO0RDgPWQV6SLNYCS4H31gWVv2YWmDNPeGhqr8QSBQvpbGDcsGwzQxifVzkIgt0wYaWhA/BzgHlWqUDNoABxNrXI7XTaYdXJJZ5enuVG7NyqLv5M/fBB9zImTs+ +bI5fw3A a2IkPvQrjEO+bT6Uu0+h4mJmZpMTNSSpzYVlYhXZ0jGqCMQp1cPqSNZInXFk07A7XqeasN/awzfG0e9ryNusimB7HMqQyZBp40oi90AgQ+S5B1bBaKqkN8GEzqc5vKLVNIfdrx6i98j6DzKJlUAup9S4XrIy0NYIb+7o00MrYFylMQcFxfNofbq39T/7QCV0pqYQl0h2PiVCQfhgOJp9geeXnIwhp9PoD4fK7n/vgGPnyv9fCLZTP4ihUltxKxmPWqJapL4EdDQkcNt9xjmWrN4YX7bPmUx0347G3RVxHThdANlkA4YbiDY8dEfKnVu5wQUhIac49XnwRzNJJQlmgaWLTcC+eZLuPoIZmvM7Cnt4pGGBGWxivs0x/WbnPG6+1PAuDdC6aXK9ehBqneMTA37igCt/d/kO4gJ4v4oGsNt/toAdiNpzUAs0ssx9ktV2w2mrg 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: In afs_wait_for_operation(), we set transcribe the call responded flag to the server record that we used after doing the fileserver iteration loop - but it's possible to exit the loop having had a response from the server that we've discarded (e.g. it returned an abort or we started receiving data, but the call didn't complete). This means that op->server might be NULL, but we don't check that before attempting to set the server flag. Fixes: 98f9fda2057b ("afs: Fold the afs_addr_cursor struct in") Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- fs/afs/fs_operation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/afs/fs_operation.c b/fs/afs/fs_operation.c index 3546b087e791..428721bbe4f6 100644 --- a/fs/afs/fs_operation.c +++ b/fs/afs/fs_operation.c @@ -201,7 +201,7 @@ void afs_wait_for_operation(struct afs_operation *op) } } - if (op->call_responded) + if (op->call_responded && op->server) set_bit(AFS_SERVER_FL_RESPONDING, &op->server->flags); if (!afs_op_error(op)) { From patchwork Mon Sep 23 15:07:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13809706 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 033CACF9C72 for ; Mon, 23 Sep 2024 15:09:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A57A66B0099; Mon, 23 Sep 2024 11:09:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D59D6B009B; Mon, 23 Sep 2024 11:09:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 89D7D6B009C; Mon, 23 Sep 2024 11:09:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 501746B0099 for ; Mon, 23 Sep 2024 11:09:02 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C9F041413E1 for ; Mon, 23 Sep 2024 15:09:01 +0000 (UTC) X-FDA: 82596335682.18.42909E9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 0F54E40027 for ; Mon, 23 Sep 2024 15:08:59 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cEhydjC1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.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=1727104105; a=rsa-sha256; cv=none; b=yaqJxZ7sGkor8QHJKbFCXhz11qPNGSf2KfRDXEV0uXqG6bnq2Hp7hhaCIQ/2P7vTrcYfvm lmP8SeeNjFifBNBuAhkkb6g752MlaGxwFW81w4Qd2R+z3ZC026naQCR0s9L2KVVmZUSo54 7Cft6k9QGfoan0d2uxUqNLK1rNnJLXw= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cEhydjC1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.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=1727104105; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=en0FbhjuTrTUZN9cCFkNjaE5g8iEA8EQ8DfNicZc0lg=; b=x1ZbGX1lbga83QN9z/kdQFjkwwntDNoBjVlgKHOuakP9c6Wc00qlzy7mPsSp98kyYtJs3W b8pgY6WZCJKHrQcQfYQjHj1GLu4qhHBar5lEJ2cycISw4/XSh3G9hmgo945EL6QxfVc5H6 ee1n8ZHrnZ7faZjJgJewKR9X3EqOeXI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727104139; 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=en0FbhjuTrTUZN9cCFkNjaE5g8iEA8EQ8DfNicZc0lg=; b=cEhydjC1V1avq9scUG1Gg6LQIQSX6CUnhkkWZEZPwvWCpqJ+WW+pQpErhhaMZkwUzPlPQ5 03JsfS1kP1dlzMwWZQIjzcfbsQbkJMg7sOn2dFQbH5dfqURhVilUhpI2HCxX45reQUY3G1 lh/8xixiUFBTVcm5uE5dz0sqdcW3Bnw= Received: from mx-prod-mc-03.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-118-hNdBfCa9Nk6QzasA8zlp7Q-1; Mon, 23 Sep 2024 11:08:57 -0400 X-MC-Unique: hNdBfCa9Nk6QzasA8zlp7Q-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.40]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 102351895D51; Mon, 23 Sep 2024 15:08:50 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.145]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C5CF4197700E; Mon, 23 Sep 2024 15:08:42 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Marc Dionne Cc: David Howells , Paulo Alcantara , Jeff Layton , Matthew Wilcox , 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, linux-kernel@vger.kernel.org, Shyam Prasad N , Rohith Surabattula Subject: [PATCH 7/8] cifs: Fix reversion of the iter in cifs_readv_receive(). Date: Mon, 23 Sep 2024 16:07:51 +0100 Message-ID: <20240923150756.902363-8-dhowells@redhat.com> In-Reply-To: <20240923150756.902363-1-dhowells@redhat.com> References: <20240923150756.902363-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Rspam-User: X-Rspamd-Queue-Id: 0F54E40027 X-Rspamd-Server: rspam01 X-Stat-Signature: 7cpt75c3aur6an3f5ntq8abhxrm9ciwr X-HE-Tag: 1727104139-917195 X-HE-Meta: U2FsdGVkX18s+JboWWE2FKmgSW5pTNpFSYJAy5j1m6vyZoy6DjUE9VlAVNsQM2NXDvZbAVdHVQGluN2AWn6NQqrwzR/dDVctJ2aqOqnj21Pslb9ah0gvSVszVtpCWTYuFcQVDUhWGvO9phh7721LfyaD+yHOrCTUy6VwsdtyoVXM9TLPQVmR+Fw9YLkEsz5/UYkfpSAY8Zg76lAAvv6+O52bCNz5Yj89U4irxtSlIrpyJY7XZ++IzMxQK3s1Cks5ReZDTqRm1aUlUbveLhXbX5Hs4P2QiYQ+h0Mxkfex3uOaQOrc4cRenIsIZROTwYU5vDWi8hJKyFgrtTi82nnWKTHqrkB/K0+vEMpPS5QjxDHs6XwbY7HSIjmG/9tAa9jH0i6J2eJFnBhMsYqGEllpqJKVyoRR1NTvrAb8LLjwvjT04sCYvKVMrEQodq9xWfZ21NaC9Iqp1nsDhHRFJzPEUHF6tNR/Wngn1HLRc2BnZEm6S6XwIgh99h5c46Js9XEt9AvAvOR5IE2ivVEWP6nHLyXku7ksaTe2f3en7iUubagdpusAWXQK/4F1dnFzABbVqsbyYtGXvQOTQItG2lkZLopI6cVwMl36V+mYKoFChimaWitxnLmmkmH0gRkPHAIRumO5A64IlGuTi1pjkeKIZGRiUiI+vsK47fCeP70hYQrG2V1WDf6DS4OsZ4nSwUUXauuZUfRog1K4qHt2NMYheWMVsty/cLPrrir3RaHqJGDai2HWV4Zt87BYquS6Z7e9gSc05jpKeesENNNNn3V86zM/xdaM6Cspy75dzvOBJZzH0XU9Z9k2BnnRqNbG+vMRJ5Im5+8QIerdRt0D0bcPrNpbuUfPYiIxvxvdXH6Oeu4Ccy0gqilACLyO8qe62vfzDtc55jdsLInQxCsXYEq6RS9GufZPvl/EFiwoYzmxZDf1z5U/gh7g37m11P39IKmLcG6XhDF56el1jZ8tp3h mSLaTYfx 8/RPYGUQTeQ8/rgm55T8q/GCeRvxMw/kx/u8xQRFLZ7LC3HjQSSsjXGsuJMlW5vEafcS52b2Lg5lrDk920QxKLlkftkpEGBOrmg+4fdcfez6uW8e7aO/6dmoi7CdziNUbMFZUWnGleUecTeHOqDB9hi3X1CWDsNVAqGHAnr1ZIzg82eizNX390Ikita77pCMbe5SCW7bKTuXF9bJrv9+9IDK2ytPAW6/MaE5nQ3Uty2uUvVvT5woNi8tzZS+V3fiM66xLV2R6CWkXh3qi/Yxp77omKrvmRXw6I8RSqXiYJ3zIgPxfk7rOBEPbDK1h49DroaO7hUuBFdhc3WFzhGleZsYZ+FQgLFLUmrCicZ2hd8Qqu2/oKPWzDMnNxNRXeGHRWC8dUKXPpL97z5M59PyZ3NA+WLUOz887GNavWim4ejKnC77ABk8FfWKhRd+ViEturceEMd7JYOEfFpfluugV62x3942hPzJsQO+CkBjWiEez5EXK1HNwgpElQFB24L+8MvSl1gCSFMJqCI+3N2+EVLyCJUqTKbM6GQuGDVgnkhZAgOtE2IwoARhk/obub9IjuR0srMBVi+W/PcYWxV5cmEnAdVIr7M7OQ+kf 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: cifs_read_iter_from_socket() copies the iterator that's passed in for the socket to modify as and if it will, and then advances the original iterator by the amount sent. However, both callers revert the advancement (although receive_encrypted_read() zeros beyond the iterator first). The problem is, though, that cifs_readv_receive() reverts by the original length, not the amount transmitted which can cause an oops in iov_iter_revert(). Fix this by: (1) Remove the iov_iter_advance() from cifs_read_iter_from_socket(). (2) Remove the iov_iter_revert() from both callers. This fixes the bug in cifs_readv_receive(). (3) In receive_encrypted_read(), if we didn't get back as much data as the buffer will hold, copy the iterator, advance the copy and use the copy to drive iov_iter_zero(). As a bonus, this gets rid of some unnecessary work. This was triggered by generic/074 with the "-o sign" mount option. Fixes: 3ee1a1fc3981 ("cifs: Cut over to using netfslib") Signed-off-by: David Howells cc: Steve French cc: Paulo Alcantara cc: Shyam Prasad N cc: Rohith Surabattula cc: Jeff Layton cc: linux-cifs@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/smb/client/connect.c | 6 +----- fs/smb/client/smb2ops.c | 9 ++++++--- fs/smb/client/transport.c | 3 --- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index 08a41c7aaf72..be6e632388f8 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -811,13 +811,9 @@ cifs_read_iter_from_socket(struct TCP_Server_Info *server, struct iov_iter *iter unsigned int to_read) { struct msghdr smb_msg = { .msg_iter = *iter }; - int ret; iov_iter_truncate(&smb_msg.msg_iter, to_read); - ret = cifs_readv_from_socket(server, &smb_msg); - if (ret > 0) - iov_iter_advance(iter, ret); - return ret; + return cifs_readv_from_socket(server, &smb_msg); } static bool diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index 7381ec333c6d..1ee2dd4a1cae 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -4869,9 +4869,12 @@ receive_encrypted_read(struct TCP_Server_Info *server, struct mid_q_entry **mid, goto discard_data; server->total_read += rc; - if (rc < len) - iov_iter_zero(len - rc, &iter); - iov_iter_revert(&iter, len); + if (rc < len) { + struct iov_iter tmp = iter; + + iov_iter_advance(&tmp, rc); + iov_iter_zero(len - rc, &tmp); + } iov_iter_truncate(&iter, dw->len); rc = cifs_discard_remaining_data(server); diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c index fd5a85d43759..91812150186c 100644 --- a/fs/smb/client/transport.c +++ b/fs/smb/client/transport.c @@ -1817,11 +1817,8 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) length = data_len; /* An RDMA read is already done. */ else #endif - { length = cifs_read_iter_from_socket(server, &rdata->subreq.io_iter, data_len); - iov_iter_revert(&rdata->subreq.io_iter, data_len); - } if (length > 0) rdata->got_bytes += length; server->total_read += length; From patchwork Mon Sep 23 15:07:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13809707 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 84062CF9C6F for ; Mon, 23 Sep 2024 15:09:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 173306B009D; Mon, 23 Sep 2024 11:09:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 123186B009E; Mon, 23 Sep 2024 11:09:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F07FD6B009F; Mon, 23 Sep 2024 11:09:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id CF68B6B009D for ; Mon, 23 Sep 2024 11:09:08 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 561261613CD for ; Mon, 23 Sep 2024 15:09:08 +0000 (UTC) X-FDA: 82596335976.17.F232CC8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 9522D4001C for ; Mon, 23 Sep 2024 15:09:06 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=e3HqVdBO; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.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=1727104059; a=rsa-sha256; cv=none; b=hD1Dk7eKGDD2OmESzZcDEeSYpJvncKSEF6ZYAKrUWT8P+Bjo6KZ4RZvWQRLTM2hAxuXJci ndEHqlWy5paziQ5pzW2mqD9AfNvbrxs97Axtfds/ZjYdEtwdDUqsEYWbmHvWD3J5zZvOVK mqG0Zxk8mRKGIVsJyMjazN+THBhiYQQ= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=e3HqVdBO; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.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=1727104059; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=h43zAABX1+Y84szWbuf6Y3zUUIJDGkYGOYZIeY5MUOA=; b=vSpil9QNVQqemBaA+7aj4MQ8LvP9FSdWdFmdVpI72HMz3OvCPjjgJ06wSB2nM4iKmSjU7K Zh2GWHyY29NE4L3pqYkVaxZt0K+7UTiyR+O9XpCvRGUcvy3kkqn1ZykvG9VfhVCn6Hb/zM WXzAdNzBtTx9ozZk2JqPhxFoflc418U= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727104145; 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=h43zAABX1+Y84szWbuf6Y3zUUIJDGkYGOYZIeY5MUOA=; b=e3HqVdBOeUT2XysHFnpi3ubvIzrWLdUsOWNwB/sPxfqfJVb6dxOZlNDcDHq5+DScL/Hynd 8B+F67q7uabSYxiT8HmyHcsD63+/WdMRyWAXkyKbxy+epyRhT/ArFel8kGqJ2jcDVXYi49 KJpww5qq1u1VaJuX+aCCg00WhmoBYcM= Received: from mx-prod-mc-02.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-464-iresh_brOiyWhufnlrfLWA-1; Mon, 23 Sep 2024 11:09:02 -0400 X-MC-Unique: iresh_brOiyWhufnlrfLWA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (unknown [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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E0E2718BC2C9; Mon, 23 Sep 2024 15:08:52 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.145]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8B0E21955D87; Mon, 23 Sep 2024 15:08:48 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Marc Dionne Cc: David Howells , Paulo Alcantara , Jeff Layton , Matthew Wilcox , 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, linux-kernel@vger.kernel.org, Steve French Subject: [PATCH 8/8] cifs: Make the write_{enter,done,err} tracepoints display netfs info Date: Mon, 23 Sep 2024 16:07:52 +0100 Message-ID: <20240923150756.902363-9-dhowells@redhat.com> In-Reply-To: <20240923150756.902363-1-dhowells@redhat.com> References: <20240923150756.902363-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Rspamd-Queue-Id: 9522D4001C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: sn6o5ixwpmmspibkexzw1i44b1i9gsao X-HE-Tag: 1727104146-143804 X-HE-Meta: U2FsdGVkX1+cgk4YmE544APkVZ0sUINEDG3/7byWZF7X+vXLC1lCM7qw/bXk/bvHOTKS1Kv1mfg0dEligfFRwfnE4dzc34jEMydWL8lps30i9OLJunN5sCt6tgz8psVfZlvlP8ldqH48gJ+kkWvI93M7b+do7LifYkYnkAdQs8sku7gTWV3h1pM6lw72INBrKdfzJnRbyyEJxifZnFR/XjoUmwqO+iK4GGomAcDaMe6RD3tyJS5A7PE67id4ml3zzBBFvV7V5aHyO/E9VpnldVo4gFm+GEtOeDCkBfWNs09XOkeRWzuVSB8q1kWzzQJTlBpSTvP/62x4ZSsDNgqQURqM1uD6TGUxWEqY3Gwuxw/4UWl0iMYwLhFuyzRiLrX2kD3E5XgnEvn3yN2PWNhLxcVF4osYeeXfE+xU5djNFSA46CuDSBPOlIvF/bhnQyNURQtFsfc+2a+lSzw39wheRMiTagTBSI0LnU+4k/o8ePziWwexkEowNuQZjIHQ9SJ7DZo5gxvlJhtFvhVYZtH1npOHFNN9dYAVs/6jS3OvlkfKrQdx9yckBoa7e2vr2J8gdLR4VrI5rgaRLzZZGEywRV/tBo9PtG/gxZDUAKPqz6cdwAggRNEglNKn6eXIHUgvpRuiCUftHKUUQ9GHbb8u0gSsSUqgNoG7p3twy7mVNJsZAAXl9euJkWFOVWbvaNw+8c3cJJfnKWUtV6FOIO+5mvnlk2HNDeMe7Cx7hEBWFH/xIeVFEvMn/3TdYWqwLt9vTs4IJiAGNJ8PE+4P/aAoviZZikSgT8GxxEt7PKlVgBuhkiyUabD+jpbRT8LQ37jMoQlXjsazFpndtfidejgU3Jm4J9UHlSB+MyPZwyMyISp5stXbsp19NxobBb+oF08iDUYlDQJhW9eSSTwF0oR4She01tu1bGeB395bBatiffOs6IevRn8uUol/Uf+e7gNm94X7uWkh/ank8jT2mGo u/7+nsk/ WYNpXluZMXWoP2JeRfNyOEcQ3CdFJJytyUMzLrrQbnHG/aC20E/BS9wTQpN5BTnZAVw2aogCB2YA2rnBRzbsSHIpFxgn2pZQYQDQwuk/ik6mDPgBypaLUXgOpqfwbzvZS+QownEaSXnf577pDsPR6AjzAAwPP515quep14kHcmtSmLrSd0h6GktyCoGCzBOgofmbY/ytx4gyExO9rSeL/+S0PiwF1GXM1rMx8EOKiLgTMsgvERo/a+CUDj2H19Mq0dUYOgD5kDZrPLCKnOqFttUtE5tlgfwqP2BYVntg3gDHX6VpbclBzkkhKtawvXx0J6DylPjIQ2u80S6ZvmVEp5uOun3dcrd2oFbUJYw1jOoF6dehtpJ7/dv92etMDPgKRjTzXM9jy1Pt0lhrRIDfLr2d5z2cqgqwZJ/PnQi6dUIgqMzoTHewRHTilGB1JeVgmHa6wTv3IkSpY1QbrvHKpbutUNDTc9qYnJrO+ 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: Make the write RPC tracepoints use the same trace macro complexes as the read tracepoints and display the netfs request and subrequest IDs where available (see commit 519be989717c ("cifs: Add a tracepoint to track credits involved in R/W requests")). Signed-off-by: David Howells cc: Steve French cc: Paulo Alcantara (Red Hat) 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 | 22 +++++++++++++++------- fs/smb/client/trace.h | 6 +++--- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 0b63608aeecb..9afc3baba27b 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -4858,7 +4858,9 @@ smb2_writev_callback(struct mid_q_entry *mid) #endif if (result) { cifs_stats_fail_inc(tcon, SMB2_WRITE_HE); - trace_smb3_write_err(wdata->xid, + trace_smb3_write_err(wdata->rreq->debug_id, + wdata->subreq.debug_index, + wdata->xid, wdata->req->cfile->fid.persistent_fid, tcon->tid, tcon->ses->Suid, wdata->subreq.start, wdata->subreq.len, wdata->result); @@ -4866,7 +4868,9 @@ smb2_writev_callback(struct mid_q_entry *mid) pr_warn_once("Out of space writing to %s\n", tcon->tree_name); } else - trace_smb3_write_done(0 /* no xid */, + trace_smb3_write_done(wdata->rreq->debug_id, + wdata->subreq.debug_index, + wdata->xid, wdata->req->cfile->fid.persistent_fid, tcon->tid, tcon->ses->Suid, wdata->subreq.start, wdata->subreq.len); @@ -4944,7 +4948,9 @@ smb2_async_writev(struct cifs_io_subrequest *wdata) offsetof(struct smb2_write_req, Buffer)); req->RemainingBytes = 0; - trace_smb3_write_enter(wdata->xid, + trace_smb3_write_enter(wdata->rreq->debug_id, + wdata->subreq.debug_index, + wdata->xid, io_parms->persistent_fid, io_parms->tcon->tid, io_parms->tcon->ses->Suid, @@ -5024,7 +5030,9 @@ smb2_async_writev(struct cifs_io_subrequest *wdata) wdata, flags, &wdata->credits); /* Can't touch wdata if rc == 0 */ if (rc) { - trace_smb3_write_err(xid, + trace_smb3_write_err(wdata->rreq->debug_id, + wdata->subreq.debug_index, + xid, io_parms->persistent_fid, io_parms->tcon->tid, io_parms->tcon->ses->Suid, @@ -5104,7 +5112,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, offsetof(struct smb2_write_req, Buffer)); req->RemainingBytes = 0; - trace_smb3_write_enter(xid, io_parms->persistent_fid, + trace_smb3_write_enter(0, 0, xid, io_parms->persistent_fid, io_parms->tcon->tid, io_parms->tcon->ses->Suid, io_parms->offset, io_parms->length); @@ -5125,7 +5133,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, rsp = (struct smb2_write_rsp *)rsp_iov.iov_base; if (rc) { - trace_smb3_write_err(xid, + trace_smb3_write_err(0, 0, xid, req->PersistentFileId, io_parms->tcon->tid, io_parms->tcon->ses->Suid, @@ -5134,7 +5142,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, cifs_dbg(VFS, "Send error in write = %d\n", rc); } else { *nbytes = le32_to_cpu(rsp->DataLength); - trace_smb3_write_done(xid, + trace_smb3_write_done(0, 0, xid, req->PersistentFileId, io_parms->tcon->tid, io_parms->tcon->ses->Suid, diff --git a/fs/smb/client/trace.h b/fs/smb/client/trace.h index 8e9964001e2a..0b52d22a91a0 100644 --- a/fs/smb/client/trace.h +++ b/fs/smb/client/trace.h @@ -157,6 +157,7 @@ DEFINE_EVENT(smb3_rw_err_class, smb3_##name, \ TP_ARGS(rreq_debug_id, rreq_debug_index, xid, fid, tid, sesid, offset, len, rc)) DEFINE_SMB3_RW_ERR_EVENT(read_err); +DEFINE_SMB3_RW_ERR_EVENT(write_err); /* For logging errors in other file I/O ops */ DECLARE_EVENT_CLASS(smb3_other_err_class, @@ -202,7 +203,6 @@ DEFINE_EVENT(smb3_other_err_class, smb3_##name, \ int rc), \ TP_ARGS(xid, fid, tid, sesid, offset, len, rc)) -DEFINE_SMB3_OTHER_ERR_EVENT(write_err); DEFINE_SMB3_OTHER_ERR_EVENT(query_dir_err); DEFINE_SMB3_OTHER_ERR_EVENT(zero_err); DEFINE_SMB3_OTHER_ERR_EVENT(falloc_err); @@ -370,6 +370,8 @@ DEFINE_EVENT(smb3_rw_done_class, smb3_##name, \ DEFINE_SMB3_RW_DONE_EVENT(read_enter); DEFINE_SMB3_RW_DONE_EVENT(read_done); +DEFINE_SMB3_RW_DONE_EVENT(write_enter); +DEFINE_SMB3_RW_DONE_EVENT(write_done); /* For logging successful other op */ DECLARE_EVENT_CLASS(smb3_other_done_class, @@ -411,11 +413,9 @@ DEFINE_EVENT(smb3_other_done_class, smb3_##name, \ __u32 len), \ TP_ARGS(xid, fid, tid, sesid, offset, len)) -DEFINE_SMB3_OTHER_DONE_EVENT(write_enter); DEFINE_SMB3_OTHER_DONE_EVENT(query_dir_enter); DEFINE_SMB3_OTHER_DONE_EVENT(zero_enter); DEFINE_SMB3_OTHER_DONE_EVENT(falloc_enter); -DEFINE_SMB3_OTHER_DONE_EVENT(write_done); DEFINE_SMB3_OTHER_DONE_EVENT(query_dir_done); DEFINE_SMB3_OTHER_DONE_EVENT(zero_done); DEFINE_SMB3_OTHER_DONE_EVENT(falloc_done);