From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384406; b=PKFj9pHKO84gSVXxHHC7GOzEM0EZE3pW7v4neTehpfq3oQaJBjvbPnB08M/msbnXr+pR hkTK+3NMqdaeVrXL+ng/GXfT0p2oA29G48IScUu6xbharQhdUTA3iKV7aJ1Re9UX6Ajof B710Z9zrWuLeAhHIdcwtd4/aF3EtOlAzfkwB0iQcibn962WtTKY/tGrobMn7JpbL5Q7jG /25yHX8eOu0LCqvhK36ttf6zMMtPIqzx0wGky7h36uCfs03FiyGf134owY3195Ku+2Mco aYLYU2JjxvUzgGBUFKX+QaZ/a+pD/n3sKNtejmw7vtX8U5/oIl3LT8pLjEQeiv07jtA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384406; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=V0+hO6P3hiWnVDoY4OK9HtVsHfv43+YMCWXpWRF34AU=; b=PVfMOIfkCV946yWyuWzX7beKdRfzgg7dt9Lsv3iNydA6TPwXpRb3nJEooT3D4ANf1D5N ucZB0cpyNyCDvRJBD0tsbaqn6mX4hVO0s5zB0ShHPw9ToYN4BpT+OUs+TAG6cdc1upIa6 x2c/gDJky/Jy9Cs7ttjaO33+hnYtMJxOZyRrkrT7NcItlWY0d2ScMWj2t+lW1h44AnOIH G0vSud9fCZapzHW82+dNKxo0eZTa5xyARmtOVzh0+A7LBTCNkP/RmYspWNq/18qdxseNX SLuhz8D9n6ItVFWUmygYzaosQ67bgc3kzzAcjlkTPqQG2rDFOYKPCW6y5LL2s8oS2jQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=cXF1qNm8; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC1E5606A334; Fri, 4 Dec 2026 11:40:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=cXF1qNm8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AE291F000C2; Fri, 4 Dec 2026 11:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384406; bh=V0+hO6P3hiWnVDoY4OK9HtVsHfv43+YMCWXpWRF34AU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cXF1qNm8jfM8RCKEtLPVkbUQjggJYizWx3afxyISyO1EqtPRRIJr246P+6C/ftEtx 6NyB+p6vNFOeuhF37CDqXtjzlZSOSLQl+AxdmfNabl7aIbkh/fOCk4igSrtxFB6n+i CaDbVbl9mX820/u0mL3mlh/Oy28qdootuUxpcVQI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Josef Bacik , Jan Kara , Sasha Levin Subject: [PATCH 6.6 0135/1167] ext2: only flush DIRSYNC directories on every change Date: Fri, 4 Dec 2026 18:52:42 +0900 Message-ID: <20261204100705.602580318@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@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 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josef Bacik [ Upstream commit 3f57fc2c49ed05ccfc56e4dc9eda41be95925bbd ] Every change of an ext2 directory is written to disk before the system call returns, whether the directory is DIRSYNC or not: its pages with filemap_write_and_wait() and its inode with sync_inode_metadata(). Writes which reach the device for 2000 files, and 200 directories, in a directory without DIRSYNC, with the flusher turned off: create rename unlink mkdir before 4000 8000 4000 800 after 0 0 0 0 In a directory with chattr +D the numbers are those of "before", before and after. commit bc943f4872a7 ("ext2: Don't flush page immediately for DIRSYNC directories") moved the flush from ext2_commit_chunk() to the new ext2_handle_dirsync(). The IS_DIRSYNC() check which was around it didn't move along. Fix by putting the check into ext2_handle_dirsync(). Fixes: bc943f4872a7 ("ext2: Don't flush page immediately for DIRSYNC directories") Signed-off-by: Josef Bacik Link: https://patch.msgid.link/20261027-b4-ext2-dirsync-v1-1-3dcd012d518d@toxicpanda.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin --- fs/ext2/dir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index b335f17f682f7..73c14858eabaa 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c @@ -445,6 +445,9 @@ static int ext2_handle_dirsync(struct inode *dir) { int err; + if (!IS_DIRSYNC(dir)) + return 0; + err = filemap_write_and_wait(dir->i_mapping); if (!err) err = sync_inode_metadata(dir, 1); -- 2.53.0