From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.62 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796221554; b=OA2JzjME+sqhNuLvUFYzFqO8ajpTatZXQGABnjsq54eZiZNcZL5PcYwABthzQhJul21x S/rvJyutc5KfEWVfm6JgqKVrnc/hbpJNpBVQsbWbqDAKQoAzBkWpFrKGJpudFZFbYOKZL cvNiGYBdjjkQ8sLBzuuDzTv1DdpdValGXHqgcGxfnkGpfCkrHQybBrgs7aI4H2946oQLF xmCe0IDUW/OLDukMGCLz08Ahxo5yRzJa2moZgicbsIlmSMqOPWbCGV4HPAmiBoEYMXn9k aV9SM0XdcJ8mzN31GVjew6WpNl3tKBtVHI7aEmHhyxFFvt6BEygUb/0THSz42b0Szcg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221554; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=fMkJYWI/wqtpQP/XiBhObjpDipgoOhKIZtj1mmYC2hw=; b=mHNMDMd9ftsc/fYcMSy+8XYFsaFARHcj2p3k24xDKjSu0B/m+ajjmungTDuQu/Wc+/w6 FIIulyovsnUPRCOf4Wwtfm0n46Gn8MLiOTk39isVe/5MUa6g0jzCrVRg1FI+nbWDuW9xH e1MootWwAWCexM+IluP/XqEu4HSpaf/W/9eN7sKd8Cd+U6ltsfsiKkCIMnynwZ1IMPblM 1vZdz/3UciZR10ER7wjTtn1VK2hsVcH25Tt/tuFlaNstrOAj2lJLLIE3PzxlJGYzflLYf dsIpdbZcEPcNR9hDZIl2waGhO3UQjQwf6BkwGuDDO85Ynw9rY1epzDUUqOvGziMKNSw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=OSq3cJO+; arc=none smtp.remote-ip=91.218.175.62 Received: from mta0.migadu.com (out-62.mta0.migadu.com [91.218.175.62]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C22F6606A327 for ; Wed, 2 Dec 2026 14:25:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C22F6606A327 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=OSq3cJO+ X-Envelope-To: linux-rt-devel@lists.linux.dev DKIM-Signature: a=rsa-sha256; bh=2S6Y7RWoz8RSdQ4diYnHuQodgCKx7+pHR8YjCIEb0S4=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796221551; v=1; x=1796826351; b=OSq3cJO+//kAklKuwYgilfTKZeeKbCeHtNZIxXh5lA09vPfiiZuj9mCXJ6U/pAJl8bzsPWNy TRjYzwKV6I3aKNNXQPExv58os4IxRN7VSChkCLiBYNhJHHYAGpGprpOjbMgpH4BjzPFyYrbkvFf WiRYMRP4O4hSKr+2HFhCwz6o= X-Envelope-To: linux-rt-devel@lists.linux.dev Received: by mta12.migadu.com with ESMTPS id 34be4ec6d8f8db3a; Wed, 02 Dec 2026 14:25:44 +0000 X-Mizu-Trace-ID: 34be4ec6d8f8db3a X-Migadu-Flow: FLOW_OUT From: Usama Arif To: Andrew Morton , willy@infradead.org, jack@suse.cz, david@kernel.org, axboe@kernel.dk, Christoph Hellwig , hannes@cmpxchg.org, jlayton@kernel.org, brauner@kernel.org, tz2294@columbia.edu, ritesh.list@gmail.com, chentaotao@didiglobal.com, ziy@nvidia.com, bigeasy@linutronix.de, liam@infradead.org, vbabka@kernel.org, rppt@kernel.org, mhocko@suse.com, apopple@nvidia.com, byungchul@sk.com, gourry@gourry.net, joshua.hahnjy@gmail.com, matthew.brost@intel.com, ying.huang@linux.alibaba.com, clrkwllms@kernel.org, rostedt@goodmis.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-rt-devel@lists.linux.dev, kas@kernel.org, riel@surriel.com, shakeel.butt@linux.dev, kernel-team@meta.com Cc: Usama Arif , stable@vger.kernel.org Subject: [PATCH 3/4] mm/filemap: don't drop dropbehind folios with interrupts disabled Date: Wed, 2 Dec 2026 06:24:38 -0800 Message-ID: <20261202142513.2951661-4-usama.arif@linux.dev> X-Mailer: git-send-email 2.53.1 In-Reply-To: <20261202142513.2951661-1-usama.arif@linux.dev> References: <20261202142513.2951661-1-usama.arif@linux.dev> X-Mailing-List: linux-rt-devel@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Forced-threaded interrupt handlers pass the in_task() check in folio_end_dropbehind() but run with interrupts disabled on !PREEMPT_RT, and invalidating the folio turns them back on. ext4 RWF_DONTCACHE overwrites hit this with threadirqs until commit 7d7c9c83c822 ("ext4: complete dropbehind writeback in task context"), and folios marked dropbehind after their writeback was submitted still can. Skip the drop when interrupts are disabled. The folio stays cached, as it does when the completion runs in hardirq context. Fixes: ae21c0c0ac56 ("ext4: support uncached buffered I/O") Cc: stable@vger.kernel.org Signed-off-by: Usama Arif --- mm/filemap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index a49cca600f8c3e..6674c4ef8fe036 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1663,9 +1663,10 @@ void folio_end_dropbehind(struct folio *folio) * but can happen if normal writeback just happens to find dirty folios * that were created as part of uncached writeback, and that writeback * would otherwise not need non-IRQ handling. Just skip the - * invalidation in that case. + * invalidation in that case, and also when interrupts are disabled, + * as they are in forced-threaded interrupt handlers. */ - if (in_task() && folio_trylock(folio)) { + if (in_task() && !irqs_disabled() && folio_trylock(folio)) { filemap_end_dropbehind(folio); folio_unlock(folio); } -- 2.53.1-Meta