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: 13763943 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 085321C8FC5 for ; Wed, 14 Aug 2024 20:40:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723668038; cv=none; b=q+rczbVKLeM6jBeFUmEadb88nu/YADM1QGwULBdh96MXfCcWVkQc+2RV9tx8dmBFxUtwT19YkEEA5lSXbrkKG0rPGnydbMPaiunEkC9+tlCnw+/DHvITFvxR7rI6MAgUlqwU+oadFjdPfc3ySjffU2jo3j9Ral6eFnBJRTfdPas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723668038; c=relaxed/simple; bh=8aSnR+1kxI5geABuk37UDfx3Qvp7z8whznHtpnqLch8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WsczYdoSHVKCWx0VCCOQ7fm3Ln9bITwLGCfRY7V2ezbRBW55I3wJwC/XW0Q1im9U5zTpvj2AK6du9CJLGGxWEJl0jXLzj4ZMqJUa4ABWtQokOucoBJhtWktAF6dMC1Sweg6eSbA5wXv2L3Nz36H5aQDgvxwVZ+ux7Ds9/ORaVDc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UiA2RQmx; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UiA2RQmx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723668035; 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=UiA2RQmxiUjVy16IISt9wyZsjK1+UJ3GVIxF9fmF53foMtaZoWtjfRW+DJdwSXQbpsP6K0 73+skW4y4SarlAu3GKEJZXLvcvpnh+F1Bwurwv+VvNbLFVig7xeQmbqoagJla1Rg3w9oW5 Na+jziU9SNmumtSRNgEpmIxWTaWJ0gk= 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> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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; }