From nobody Fri Sep 12 00:29:41 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C657C46CA0 for ; Wed, 6 Dec 2023 15:21:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379166AbjLFPLK (ORCPT ); Wed, 6 Dec 2023 10:11:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379221AbjLFPKs (ORCPT ); Wed, 6 Dec 2023 10:10:48 -0500 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 096DCD5B; Wed, 6 Dec 2023 07:10:54 -0800 (PST) Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 751C91E1A; Wed, 6 Dec 2023 15:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1701875068; bh=mAuuCGMqlStfHaypyBJ9iLMuzcr3BmzULzMWMwWTRuE=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=bLupnkpLf7fzkUc2Zt5omBwLubjPcPeYPgaJ3tqLEQExUyjSso2/GDYWv58+hM9Zd fhwCheq3GPFBlwishCkRPuzN547xVQMTB6CcNxkddptzAQzbiVxJDeavPAQdzRFKtx 4XYrwbbISqytrtKzvacmxjfRMfH0G33BplXtpoVE= Received: from [172.16.192.129] (192.168.211.144) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Wed, 6 Dec 2023 18:10:52 +0300 Message-ID: <8cb671f9-252b-443b-a903-ca62c9097533@paragon-software.com> Date: Wed, 6 Dec 2023 18:10:52 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 04/16] fs/ntfs3: Correct hard links updating when dealing with DOS neams Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <00fd1558-fda5-421b-be43-7de69e32cb4e@paragon-software.com> In-Reply-To: <00fd1558-fda5-421b-be43-7de69e32cb4e@paragon-software.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.211.144] X-ClientProxiedBy: vobn-exch-01.paragon-software.com (172.30.72.13) To vdlg-exch-02.paragon-software.com (172.30.1.105) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Konstantin Komarov --- =C2=A0fs/ntfs3/record.c | 16 ++++++++++++++-- =C2=A01 file changed, 14 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c index 53629b1f65e9..7b6423584eae 100644 --- a/fs/ntfs3/record.c +++ b/fs/ntfs3/record.c @@ -535,8 +535,20 @@ bool mi_remove_attr(struct ntfs_inode *ni, struct=20 mft_inode *mi, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0return false; =C2=A0=C2=A0=C2=A0 =C2=A0if (ni && is_attr_indexed(attr)) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0le16_add_cpu(&ni->mi.mrec->hard_link= s, -1); -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ni->mi.dirty =3D true; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0u16 links =3D le16_to_cpu(ni->mi.mre= c->hard_links); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0struct ATTR_FILE_NAME *fname =3D +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0attr->type !=3D A= TTR_NAME ? +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0NULL : +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0resident_data_ex(attr, +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 SIZEOF_ATTRIBUTE_FILENAME); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (fname && fname->type =3D=3D FILE= _NAME_DOS) { +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0/* Do not decreas= e links count deleting DOS name. */ +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0} else if (!links) { +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0/* minor error. N= ot critical. */ +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0} else { +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ni->mi.mrec->hard= _links =3D cpu_to_le16(links - 1); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ni->mi.dirty =3D = true; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0=C2=A0=C2=A0 =C2=A0used -=3D asize; --=20 2.34.1