From patchwork Wed Aug 14 20:38:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13763959 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 D41BBC531DC for ; Wed, 14 Aug 2024 20:40:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C2FA96B00A6; Wed, 14 Aug 2024 16:40:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BDEC66B00A7; Wed, 14 Aug 2024 16:40:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7FA06B00A8; Wed, 14 Aug 2024 16:40:43 -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 84CD86B00A6 for ; Wed, 14 Aug 2024 16:40:43 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 4DCBD1A1083 for ; Wed, 14 Aug 2024 20:40:43 +0000 (UTC) X-FDA: 82452019566.08.AFB0760 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 8D7D84000A for ; Wed, 14 Aug 2024 20:40:41 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="iP/ZIsfs"; spf=pass (imf01.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1723667945; 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=SHrBZHpEC0U+YMsJ7gsza5daMkvE96bXZCw9DF6n8k0=; b=7uyFF25vo+XNRHzTmtErKsKe+E2bRyOiE0qavcVV2DT82L88GX6WqbhFdFlql5E367gYhs BLrDX/cYBsupdFlnxgM6lHt4l/d9xKas2OlgU0C88MRHqQWtOglFV+fAmfHG4Pz+haH5t3 /yIokEozwsZF5bb8y1i17lazMtaLr+M= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="iP/ZIsfs"; spf=pass (imf01.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1723667945; a=rsa-sha256; cv=none; b=v0YSUQyR/JNUGQKVzA0Gk+8P5qJYpqWNXTM4psMLznyMwEoCF91IC6aALP4NsYqvkYea/9 H4XQEGb756KYMo0kYERnnhappZF8PTDpaD4+KbVax6j8DsvvSYl5TjrBlquKEaTNtlb4pp Hc2Xn9xiySl41AYXOaoCyi3J1LC0Spc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723668040; 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=SHrBZHpEC0U+YMsJ7gsza5daMkvE96bXZCw9DF6n8k0=; b=iP/ZIsfs1mHeIXY6DdfJqJcnsnkQfzswoFEWGQ+5rZxBJfZgukfuANbvro6E+X8Yk5g4JZ RLFxUCl6bUHyc9ME2hUPlFgaKK68zYSHBOLFuyE5coXfeqklgDHypMg/9rEeDkoePqFRco RK2CSDd6E/LFVn7OTwMejSA/RyezhTY= 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-186-9Aleb69eNYKcJguKV1KcQA-1; Wed, 14 Aug 2024 16:40:31 -0400 X-MC-Unique: 9Aleb69eNYKcJguKV1KcQA-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 0AFF7195420C; Wed, 14 Aug 2024 20:40:25 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.30]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8DE81300019C; Wed, 14 Aug 2024 20:40:19 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Matthew Wilcox Cc: David Howells , Jeff Layton , Gao Xiang , Dominique Martinet , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 11/25] netfs: Use bh-disabling spinlocks for rreq->lock Date: Wed, 14 Aug 2024 21:38:31 +0100 Message-ID: <20240814203850.2240469-12-dhowells@redhat.com> In-Reply-To: <20240814203850.2240469-1-dhowells@redhat.com> References: <20240814203850.2240469-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8D7D84000A X-Stat-Signature: 4hp1e97tearchwnsjfxgosu5kdswm8rw X-Rspam-User: X-HE-Tag: 1723668041-525106 X-HE-Meta: U2FsdGVkX1+Z+YQXsy43UeDUaFcf6fJof15rtmx6PWqx8fxsArxdtAWne0ZzplpIrIUrLuz8djtZ8DUCvxx00+qj/IJd+mCQsTYXnfLJQuI0ccjl09u0g/KZSP8giSjGqqkWI5ReSbFW6cuL1XAPuXAgRVCl/6kyfQ+KvP0tlSR3nxGtZxZEOoJerexRNFjirkOhL55sBtpsi5nA364z2BpVC4B2rljQzEvh/kbWffxyWthGt/0W4NxU1JmvN21KVtiaSCmHXheFI7lG/Wa+IBY9bNp0rClunQozN0mIf1365H3joaHIQNLg6a4hRmFu1ilMqZoDT5jbKTfzKJugwiUnvI+fe3DLuYu5/L+ZMlUeHC7nooyFucb0Crp3uOaoa0mSRjgmJSwocy5gnnOzUzHHYoves7JSzDPaMfdBq5H+AayHflSS3jdjE9fWIBEv3/kmA4Q22C/+zD/yy2rzC0QFZf3jzt9sAOY2Q3dGZZOV/9+wAPpIFjpHvfHFtes4KtXY4lpzL3jyZkuuvgBKerJdYzdt6sRreNc4RoIWvljs2mA0gTrrxvsgNSukTIgsYbU7IT1qgMpEA209wMddy6tO7KPzfYS6F6ux5U4piQtUNLt+gW/OyBkVd6TH20F5XRN7ad4TuSs2MT/xV4WaYePF2IGR2EKZVQyiPvF8+esGyWAXeorNjTq+6HSaits7jfVbMh4eUZ4kiYyD4UvfmFBvgqD3WEFygtTF03B2SjSMeLLObBLYvxu5dj8JVF9A9cEnAFtplnsFuYXblClQ8Vx8QLoeyEmq3TUVK11jHJ1SL5NqSwDF0QhHTf71quBqjoBcXy6xfAEgUeVhO8UxGX4kCPHg3S2FtEoRYVL5Fi07msdBaU9QYD1aiWdqA16/8OAIeKM6Z8SvRysDmabVlBHrf+56MGSqdPr8lg/TXsk79sIrhfMBerpE9o1esLMd+WOBaV0gcoZjLrEWrQf Xn/VqPVh Bl9NufAgG2eaRGtCFpfMyvLVFXIsX+H9aQZHd1xCtSlAFYotDOJF6LN0OEIRDWmGigSTq+WM12ycuoUpfLdl7fqt+JRTvQt13rixdFgz/Q50UYKFuHm6MD0IDsGM4IKyHw3WswwVI5bT6HqsS2+a87rTLCOf63pnxMqV1sRR5AVM7Qo1oqYkBm0W/S7EJpi/bXm+vksdfLCfm/Wjny3HVAmN1iU5P4iC94k3utA0uM+JRJUWHh1j1syJ7g3wosFw1odrT7RyVmFD1e5oy1W6lLzl4+RM3/7RR36hKqpe/aGotEdPXCD22p+5vC4wfTOV7Xbi/YOQ0Ye0SElil5is5BdoL1zAtPzQoyzX6dc2sW6FzRys= 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: Use bh-disabling spinlocks when accessing rreq->lock because, in the future, it may be twiddled from softirq context when cleanup is driven from cache backend DIO completion. Signed-off-by: David Howells cc: Jeff Layton cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/netfs/write_collect.c | 4 ++-- fs/netfs/write_issue.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/netfs/write_collect.c b/fs/netfs/write_collect.c index e105ac270090..5f504b03a1e7 100644 --- a/fs/netfs/write_collect.c +++ b/fs/netfs/write_collect.c @@ -466,7 +466,7 @@ static void netfs_collect_write_results(struct netfs_io_request *wreq) cancel: /* Remove if completely consumed. */ - spin_lock(&wreq->lock); + spin_lock_bh(&wreq->lock); remove = front; list_del_init(&front->rreq_link); @@ -482,7 +482,7 @@ static void netfs_collect_write_results(struct netfs_io_request *wreq) } } - spin_unlock(&wreq->lock); + spin_unlock_bh(&wreq->lock); netfs_put_subrequest(remove, false, notes & SAW_FAILURE ? netfs_sreq_trace_put_cancel : diff --git a/fs/netfs/write_issue.c b/fs/netfs/write_issue.c index 41db709ca1d3..7880a586343f 100644 --- a/fs/netfs/write_issue.c +++ b/fs/netfs/write_issue.c @@ -191,7 +191,7 @@ static void netfs_prepare_write(struct netfs_io_request *wreq, * the list. The collector only goes nextwards and uses the lock to * remove entries off of the front. */ - spin_lock(&wreq->lock); + spin_lock_bh(&wreq->lock); list_add_tail(&subreq->rreq_link, &stream->subrequests); if (list_is_first(&subreq->rreq_link, &stream->subrequests)) { stream->front = subreq; @@ -202,7 +202,7 @@ static void netfs_prepare_write(struct netfs_io_request *wreq, } } - spin_unlock(&wreq->lock); + spin_unlock_bh(&wreq->lock); stream->construct = subreq; }