From patchwork Mon Jul 29 16:19:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13745295 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 EB0E4C3DA4A for ; Mon, 29 Jul 2024 16:21:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C0276B0085; Mon, 29 Jul 2024 12:21:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 76E376B0088; Mon, 29 Jul 2024 12:21:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 60FAD6B00A9; Mon, 29 Jul 2024 12:21:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3F5916B0085 for ; Mon, 29 Jul 2024 12:21:47 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id AE90012042A for ; Mon, 29 Jul 2024 16:21:46 +0000 (UTC) X-FDA: 82393306212.15.D7705D9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf18.hostedemail.com (Postfix) with ESMTP id DD8891C002E for ; Mon, 29 Jul 2024 16:21:44 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NBsbDdfp; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722270101; a=rsa-sha256; cv=none; b=xXdjO0cEoOpjxVhz+i5PxO0dqGx8j+XbNsbdPLx14ZF2Muj3xeWTj6LEwUIV1ssLbRhJ0k 0Scnd5qSePOdClIhoJtOGuIXe+Xq3Wp6f/6NTxf4GFR+LWRVUvqbYPjVabOa5iUqT9Cc6L CgBG4cImZZOFnNSvIR3c9I9mKRWX4I8= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NBsbDdfp; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722270101; 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=b5eevWbmfPigkA2FdYCNfJwGB2DQgwa2DeAbWa0pHZ0=; b=jCfmfbkJC/t6u/a8W0/V1via4+VLjST4VPWL/iNzoTCmsgsEEYppSu4VQgBCkToJujvLAh k6xTudrcEMoAf724Z716bZ9U3v/5qgFrGs50VkwzDDr3rWRVQaaUsTDzyoI1/0KR7jZx+y xQ1NYOrXDpIF6GFCIMAlG7+R13ymoH0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722270104; 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=b5eevWbmfPigkA2FdYCNfJwGB2DQgwa2DeAbWa0pHZ0=; b=NBsbDdfpANJDJhutbv1/vIqGp185orA/f0uRWsHGXHfwSjxnrCUMLQaVGFPecIzZSC2m2M 6GPcOBG02n4pJL9K7p4mVM5wYg46eSMgreLF8tgaUDQx7EWb4tqS7N9ryODWiIgEjYrW6m ZBg4KVsmE/WBIt2tOBwS+SFb/MEgyTs= 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-224-U_DNJ7EfOGy2k1Ad-Ws3sQ-1; Mon, 29 Jul 2024 12:21:40 -0400 X-MC-Unique: U_DNJ7EfOGy2k1Ad-Ws3sQ-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [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 E7D201955F41; Mon, 29 Jul 2024 16:21:35 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.216]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 388E81955F40; Mon, 29 Jul 2024 16:21:30 +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 11/24] netfs: Use bh-disabling spinlocks for rreq->lock Date: Mon, 29 Jul 2024 17:19:40 +0100 Message-ID: <20240729162002.3436763-12-dhowells@redhat.com> In-Reply-To: <20240729162002.3436763-1-dhowells@redhat.com> References: <20240729162002.3436763-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspam-User: X-Rspamd-Queue-Id: DD8891C002E X-Rspamd-Server: rspam01 X-Stat-Signature: 7wc37hxbhic897o91m5tbfyb6bo9coku X-HE-Tag: 1722270104-110027 X-HE-Meta: U2FsdGVkX1+Dc6r3OPEtEUoBQ5YnK6zh5+ifebowsFSlhEwmvTfu0gRqP612dvZ0Y162Q5FKXkWI2AndSjwN3v2cm9jdtjW8Y2xNZ8ANVwr9BrXNGjcCswFFRa2trpHboJAFAAv3F3z0Rmi8TBRA2yMFZucsI4HaQKuRh/LRalmWADyh5zTEE25S05lYPEklPeBHF3eYZ5IAdxMlElGE9H1wVzscJEMZyv+Jk4MtSyc0mlTLdwKeQDRTH2oerZMVutpCUk7YMp2pP4uFmGY26Yp5TMCZa07wVJMs42xGJXydLqBYKniMEiLE3MWJ9dgF1l+OdGcSLafhRI7RN9uFyPNh9TLt3KLQMWuABBF8i5HtCWoV/tND8a/L+iAG8yBcjL+PJwXsO7ZNQ1xAOzWFE0PyV6uRhpADF9Kuss0urr9ldRS+c0Ttr71pN5/r7vfQWXCNe8l5oGLV90IeYc8DYXrJnT28LuXWUB4BL39rqFjToF6ahs2TX01jr2qPGkEIajaHjrCBsTe/VW3822gdxGXTiS4Nk9T8hx98x/ynCTdOMSFhEYAq3JV+dUNsZg4t+cot9cJjskJi54LeXOvn9KiDjEEp3XCNOcT8SmjwCNZsQaDeekeM67kxgzVhWag7K0V2eJqHBDZgAe3DPaLVcgLDyHpwt/3ILnAUhqiJPsk14nchnecJZBvCmnLsBr38dyozhMoAV8WeBTxJBKKT5/O0wNY03pVYxfatfnei/sD/cND01lLtaHyu4FPS3y/mx9NRjkeIVjDNZnkMSoXUZnFHnXDitVqNTJWFqmqkCB72nsfEr5Mf8RWBqqS6wAwLZpCFp9fYodoKy6ptgHzTH8xxkoDwHu0x0dwnJWMTv0rHmVhkmYZDntJJduLsdrS1WxuYXuyB8vNatAtljnJKeJryMGQzc06F8E1ORpt8K8ZczM5vxJ40dh9efHAkAgFEhhEgnnHW9vNxPmd/isz x3nq1IsJ RUVoVNswEcUOQg2bTimymOzG+sXIbkmlnAoH66NPRrYmUj2qaBpRsAXtGfDkFS18zEdUXaOwO/nvArJNHi5gzmreUgNWh1SnkRVCITdZrTdIrkNXtcKhc4RWoGVcP0R5ebIvh6/rkFAxetidI/12dIKQzJ13L6uFk3RSYFV5UuTqefmVuLHcw3pEslEn397O1UNpOPL20rH8eVVZBjIw9HNUBfP/TYuwcIWrCZ1yq3D2y6XoRm793IYd3Iclf2rREIBv23/DER+4YYsASg6MfVA0V1LBkyNnEaqWgRbdfgrCDzOGznc/kfKaaCuEuYdbm3kEKWODftz2L2jjzulbBsEA+xlpOK+IroRsTK+AJ9Atzdw8= 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 6e835670dc58..0354c992467b 100644 --- a/fs/netfs/write_issue.c +++ b/fs/netfs/write_issue.c @@ -189,7 +189,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; @@ -200,7 +200,7 @@ static void netfs_prepare_write(struct netfs_io_request *wreq, } } - spin_unlock(&wreq->lock); + spin_unlock_bh(&wreq->lock); stream->construct = subreq; }