From nobody Sat Jun 13 17:09:10 2026 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49568369203 for ; Wed, 6 May 2026 07:56:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778054161; cv=none; b=e+cGGIpoed0skFxsrXDIPUiKMbIviZkTH5lRgNNLwszrJkXkavX9hRvWtL2X8wh6WSF3psKLXbR/5aqs0LyHX8CMbWD92PmXJQDHiLwZaqP0huW2cJljKpC2J9C3D1b1OjVbiHrJaxiTeQwZuY2zcfkx0VG9mr/1FSSLuV7k8po= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778054161; c=relaxed/simple; bh=Zn/HSxgx9qZwQ5YGcGoKI6Qy28bsewtR+Ggg1f8p6C0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y1QaQo0NKwN5OldJV+gqUTmqkuwahNuDbcHro0+fv4kvh2mt8UevAzx0Ws33HGpU16PND3xz1wOOLg6rv3XkT5gPFasQ59hmdMm+SyCU+LDaAyhXmbN3GJhtoWAmOlw7HGbGzAd/SCaEUpG74/xu5kSa+zxti5yHg77MuGko8CM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ls/u1PSN; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ls/u1PSN" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-82fbf5d4dc2so4407239b3a.1 for ; Wed, 06 May 2026 00:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778054160; x=1778658960; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P/svLyhDt4LmrmppOf0GneXzDZZYkFPlrB5biDFWZro=; b=ls/u1PSN5kuiVWrNRfnXJqZjWLudKqCWMtxljFOjqS6TVsJQhplDKckFseKsUxxIym fr9rCb2hx6/EHlRAEiuS+fr/DtnVVnPY8IoUtHXH1d8138W0dptnFA0bxmVcn+s/WVsF mn2SICsEpMbAK5m1W4tZbV6IibXaN3ExAJgw/y0B/PPNks33GVWaeiKfAI/FLh66iiVp NDbws64rx9PiQsqJKU2y7xaX29lN2Br93r0oxoDOwToBSK3aq7oAr/C72sA+I7RiHTK7 OSp9cJFPLKY3JLXOaZaxy6qvD1/amx9pc8TrpglEkA9O3LBZ5gdZuBy5rZKA4kPDdoEz pTow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778054160; x=1778658960; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=P/svLyhDt4LmrmppOf0GneXzDZZYkFPlrB5biDFWZro=; b=e2LrHx4cWUKQoYYzKh95Ha8awUw6w/qSqzizNtDIYbT7b/ztCmQD66OPJmxKylm7TR xR6gnWubPn1f+UJWheNcfYe0u6+u/LCT7BurFr/HQfbd3BlIlCivfqEqdy1/N08zHWI8 xDNPffNtNzLz9+9vyu0zbJi5jALrYogBhivsr4jAwl7nf8+fcQIzilhHDftmGg83TP6V oSKSE3wdmopNFN1wEdBtztZZ/xLWkI9lLVppFiN57NgrXM4fb7JfUs4VtwiXez3HG+Hn BDpljQ7EFgA+Zk/t2zVf4guQ2rAi/nPjeAYtjiYd8RghywyaZbdo6ic2Iy1cd5k/JLa1 Ok1Q== X-Forwarded-Encrypted: i=1; AFNElJ+NnLmxXL25pPz8lewp0eYna0VJpaGq+HBYqS5oi9k2Enmr8mczZX+MdjV9P7n6GQLeWG5AhqDGZsX3ugE=@vger.kernel.org X-Gm-Message-State: AOJu0Yzi+ZA0Hqv4xLh4VklG/b68sJEdiztt5GciZva9x6eUG4sJMwEp kaZowSrwd6ByVIuu3RqiyXmo30vu4qD9I6OTeyb4XzlP+5mg1FJSVT2k X-Gm-Gg: AeBDievuHQQuGY3m3B6Rgt+jRomi9aKWdRKLjgFHSO8SoQssaxC6BeRXUT9RBFzGROR GCcgv4A+DyxM6NdOREyptRfv2Vjy8jGYKfa2ku3P5i0fGPJCBAQRsF/X4ockE2bjrCxeiYKri6R DtvQ9Io8WSf0FhugzX5Dl3CIjFFOVkRAHu2WKzwqhG3M2sQ34tiNVjLNOZ2fI0cAZqAGMO0SItK bugXhjfIgmVqLuFEqFMoofIbBuh/4QJJcSGUy1mH698+vok8aA1ltorZAEhOJdObrjtKzwUt4cD f0Ft9/DD2TZb0rAXZFH3fQi4weQr1PgUc7IDq4xSv3qmJDick1Wo86tHiyIcF3mN9PArVgvEyew Ygqw2RMq/fQ7QjjBHUmkwL7sEsGLDV2pBz+vMGV+UziGm2AC3melWxHimfBh38fhojTa32BOkuh r13oe0Ujo/PkUdNH/PyL0D16/w43ZozLb6ddt4ADMMZ/wwxjyCoN+0L7lfJA== X-Received: by 2002:a05:6a00:10d2:b0:82d:603f:f3a with SMTP id d2e1a72fcca58-83a5df4b0c2mr2178592b3a.24.1778054159720; Wed, 06 May 2026 00:55:59 -0700 (PDT) Received: from DESKTOP-MOQC9AF.mioffice.cn ([43.224.245.246]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-839679c8c10sm4421502b3a.37.2026.05.06.00.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2026 00:55:58 -0700 (PDT) From: Zhan Xusheng X-Google-Original-From: Zhan Xusheng To: almaz.alexandrovich@paragon-software.com Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Zhan Xusheng Subject: [PATCH] fs/ntfs3: fix syncing wrong inode on DIRSYNC cross-directory rename Date: Wed, 6 May 2026 15:55:54 +0800 Message-ID: <20260506075554.7469-1-zhanxusheng@xiaomi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422152010.205694-1-zhanxusheng@xiaomi.com> References: <20260422152010.205694-1-zhanxusheng@xiaomi.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In ntfs3_rename(), when IS_DIRSYNC(new_dir) is true, the code syncs the renamed file inode instead of the target directory new_dir: if (IS_DIRSYNC(new_dir)) ntfs_sync_inode(inode); /* should be new_dir */ DIRSYNC requires that directory metadata changes are written to disk synchronously. Since new_dir was modified (a new directory entry was added), it is new_dir that must be synced to satisfy the guarantee, not the renamed file itself. This bug has existed since the initial ntfs3 implementation and was carried through the refactoring in commit 78ab59fee07f ("fs/ntfs3: Rework file operations"). Fix by syncing new_dir instead of inode. Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation") Cc: stable@vger.kernel.org Signed-off-by: Zhan Xusheng --- v2: - Cc ntfs3@lists.linux.dev (was missing in v1, see https://lore.kernel.org/all/20260422152010.205694-1-zhanxusheng@xiaomi.c= om/). - Add Cc: stable@vger.kernel.org; this is a data-persistence bug under DIRSYNC and affects all ntfs3 since 4342306f0f0d. v1: https://lore.kernel.org/all/20260422152010.205694-1-zhanxusheng@xiaomi.= com/ --- fs/ntfs3/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c index b2af8f695e60..64cde1a856f4 100644 --- a/fs/ntfs3/namei.c +++ b/fs/ntfs3/namei.c @@ -340,7 +340,7 @@ static int ntfs_rename(struct mnt_idmap *idmap, struct = inode *dir, ntfs_sync_inode(dir); =20 if (IS_DIRSYNC(new_dir)) - ntfs_sync_inode(inode); + ntfs_sync_inode(new_dir); } =20 if (dir_ni !=3D new_dir_ni) --=20 2.43.0