From nobody Fri Dec 19 22:05:53 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 3C121E7D273 for ; Tue, 26 Sep 2023 10:03:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234352AbjIZKDs (ORCPT ); Tue, 26 Sep 2023 06:03:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233494AbjIZKDk (ORCPT ); Tue, 26 Sep 2023 06:03:40 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB2359D; Tue, 26 Sep 2023 03:03:33 -0700 (PDT) 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 2C14521B2; Tue, 26 Sep 2023 09:49:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721752; bh=kAFpjOH/j+mFhP/dbJ+h064bbKIbyxWjdj14UYWkif4=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=sf7vwL7pD4XmCvSSu1u+/Qs9dywy2OUuIS41mzq8+6cDl7HRW58DdJE/pGbXdxG7W 8esrH546aBgfPm0c16uslwljvDC00HdawiqaakDlhlt6Lk1gGiaAgMwwUPVFNVKE/I ePGBBbv0r3b4HuOvkrncANp+eXRa5IeymtUbLlmM= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:55:02 +0300 Message-ID: <48fb5955-7d88-4133-8c85-47eb53248825@paragon-software.com> Date: Tue, 26 Sep 2023 12:55:02 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/8] fs/ntfs3: Use inode_set_ctime_to_ts instead of inode_set_ctime Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.211.137] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) 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/inode.c | 2 +- =C2=A01 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index eb2ed0701495..2f76dc055c1f 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -170,8 +170,8 @@ static struct inode *ntfs_read_mft(struct inode *inode, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0nt2kernel(std5->cr_time, &ni->= i_crtime); =C2=A0#endif =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0nt2kernel(std5->a_time, &inode= ->i_atime); -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ctime =3D inode_get_ctime(inode); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0nt2kernel(std5->c_time, &ctime= ); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0inode_set_ctime_to_ts(inode, ctime); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0nt2kernel(std5->m_time, &inode= ->i_mtime); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ni->std_fa =3D std5->fa; --=20 2.34.1 From nobody Fri Dec 19 22:05:53 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 C95ABE7D271 for ; Tue, 26 Sep 2023 09:55:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234289AbjIZJzx (ORCPT ); Tue, 26 Sep 2023 05:55:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233768AbjIZJzl (ORCPT ); Tue, 26 Sep 2023 05:55:41 -0400 X-Greylist: delayed 69 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 26 Sep 2023 02:55:33 PDT Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89D00F3; Tue, 26 Sep 2023 02:55:32 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id AD98621BC; Tue, 26 Sep 2023 09:49:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721780; bh=zfpCmKTIrrX/Tm3omQLSw+qcCQMVXlnwzcY50MQ9HGI=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=r2zvMgty3J9zp812qs5vRyTGyhzL4ji93J7KqP6mRh+wYZyf81AwZM3JekNdNREfc IbCdHVL/ZUFIjro0fgcAi47CjY+xbxSoMH9BlQlueLTJlDy3YBD16zx3D3LCgOobbz Tk8hyV0LgKJTIvDAXJkonFNTdH4mxk3CdDJLjZrg= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id 08C121D45; Tue, 26 Sep 2023 09:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695722131; bh=zfpCmKTIrrX/Tm3omQLSw+qcCQMVXlnwzcY50MQ9HGI=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=sGwkdNutAIoorXYu/T6+JY8sssgHV7lXRSTMrVQjslvRO+0aOJMbH4UQ9yBUZMGFk wHz1Z0bt62kPwnvZEKtzPbbRV33DUTwOT6hvkkRrW2nL6joHqFkhlCAAmTLa4N7Iy+ REc7lvXd35mxwZBaXLtqaAr86MbWhI1S4UW6HUgg= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:55:29 +0300 Message-ID: <18681891-e588-4745-8cfc-2fe5fc0eee54@paragon-software.com> Date: Tue, 26 Sep 2023 12:55:29 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/8] fs/ntfs3: Allow repeated call to ntfs3_put_sbi Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.211.137] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) 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/bitmap.c |=C2=A0 1 + =C2=A0fs/ntfs3/super.c=C2=A0 | 21 ++++++++++++++++----- =C2=A02 files changed, 17 insertions(+), 5 deletions(-) diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c index d66055e30aff..63f14a0232f6 100644 --- a/fs/ntfs3/bitmap.c +++ b/fs/ntfs3/bitmap.c @@ -125,6 +125,7 @@ void wnd_close(struct wnd_bitmap *wnd) =C2=A0=C2=A0=C2=A0 =C2=A0struct rb_node *node, *next; =C2=A0=C2=A0=C2=A0 =C2=A0kfree(wnd->free_bits); +=C2=A0=C2=A0 =C2=A0wnd->free_bits =3D NULL; =C2=A0=C2=A0=C2=A0 =C2=A0run_close(&wnd->run); =C2=A0=C2=A0=C2=A0 =C2=A0node =3D rb_first(&wnd->start_tree); diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index f78c67452b2a..71c80c578feb 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -576,20 +576,30 @@ static noinline void ntfs3_put_sbi(struct=20 ntfs_sb_info *sbi) =C2=A0=C2=A0=C2=A0 =C2=A0wnd_close(&sbi->mft.bitmap); =C2=A0=C2=A0=C2=A0 =C2=A0wnd_close(&sbi->used.bitmap); -=C2=A0=C2=A0 =C2=A0if (sbi->mft.ni) +=C2=A0=C2=A0 =C2=A0if (sbi->mft.ni) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0iput(&sbi->mft.ni->vfs_inode); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sbi->mft.ni =3D NULL; +=C2=A0=C2=A0 =C2=A0} -=C2=A0=C2=A0 =C2=A0if (sbi->security.ni) +=C2=A0=C2=A0 =C2=A0if (sbi->security.ni) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0iput(&sbi->security.ni->vfs_in= ode); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sbi->security.ni =3D NULL; +=C2=A0=C2=A0 =C2=A0} -=C2=A0=C2=A0 =C2=A0if (sbi->reparse.ni) +=C2=A0=C2=A0 =C2=A0if (sbi->reparse.ni) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0iput(&sbi->reparse.ni->vfs_ino= de); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sbi->reparse.ni =3D NULL; +=C2=A0=C2=A0 =C2=A0} -=C2=A0=C2=A0 =C2=A0if (sbi->objid.ni) +=C2=A0=C2=A0 =C2=A0if (sbi->objid.ni) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0iput(&sbi->objid.ni->vfs_inode= ); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sbi->objid.ni =3D NULL; +=C2=A0=C2=A0 =C2=A0} -=C2=A0=C2=A0 =C2=A0if (sbi->volume.ni) +=C2=A0=C2=A0 =C2=A0if (sbi->volume.ni) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0iput(&sbi->volume.ni->vfs_inod= e); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sbi->volume.ni =3D NULL; +=C2=A0=C2=A0 =C2=A0} =C2=A0=C2=A0=C2=A0 =C2=A0ntfs_update_mftmirr(sbi, 0); @@ -1577,6 +1587,7 @@ static int ntfs_fill_super(struct super_block *sb,=20 struct fs_context *fc) =C2=A0=C2=A0=C2=A0 =C2=A0iput(inode); =C2=A0out: =C2=A0=C2=A0=C2=A0 =C2=A0kfree(boot2); +=C2=A0=C2=A0 =C2=A0ntfs3_put_sbi(sbi); =C2=A0=C2=A0=C2=A0 =C2=A0return err; =C2=A0} --=20 2.34.1 From nobody Fri Dec 19 22:05:53 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 075ADE7D272 for ; Tue, 26 Sep 2023 09:56:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233076AbjIZJ4S (ORCPT ); Tue, 26 Sep 2023 05:56:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233553AbjIZJ4J (ORCPT ); Tue, 26 Sep 2023 05:56:09 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99E5B1BB; Tue, 26 Sep 2023 02:55:55 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 6DAF221BC; Tue, 26 Sep 2023 09:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721803; bh=Nf2tlL8ndkT5fumOF9aSaoVeSNGQzhIY6kDh91oVRUE=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=ncv0G8arOqm3X0jid+4L2MVE689rRbad7e+k+2BtujmZbDit/pHvyARgZuZx771R8 G/gat1h2aicoRanLAt5Kgn0z0Vtgcy1QHRdoGKO9Wev7FT3X2wi0O54CLxk46+waT6 tAL85kb0QqmYZYfglW65WrgRuZDzW3+v3hnWcVbg= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id BC64A1D45; Tue, 26 Sep 2023 09:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695722153; bh=Nf2tlL8ndkT5fumOF9aSaoVeSNGQzhIY6kDh91oVRUE=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=iiibi4ADh06yd/BR2C+7DGZUaIaGB5nAQx2rdMPVvbAHFhoW2q0ApmU24dyT7+e/V SHf1Z9nkn0L5Y96wEVu+wEa/PxzC5SI8UzgatQ9S+FCm4geVL0Tip2yPrqTutDdc6E 0h4Ox3DQLEdMQEdWIIyfRU7i0lv4LVt9yMs00yDY= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:55:53 +0300 Message-ID: <1f95ab55-ce05-4c11-8c14-8df260514208@paragon-software.com> Date: Tue, 26 Sep 2023 12:55:53 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 3/8] fs/ntfs3: Fix alternative boot searching Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.211.137] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) 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/super.c | 10 +++++++--- =C2=A01 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 71c80c578feb..d2951b23f52a 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -846,7 +846,7 @@ static int ntfs_init_from_boot(struct super_block=20 *sb, u32 sector_size, =C2=A0=C2=A0=C2=A0 =C2=A0struct ntfs_sb_info *sbi =3D sb->s_fs_info; =C2=A0=C2=A0=C2=A0 =C2=A0int err; =C2=A0=C2=A0=C2=A0 =C2=A0u32 mb, gb, boot_sector_size, sct_per_clst, recor= d_size; -=C2=A0=C2=A0 =C2=A0u64 sectors, clusters, mlcn, mlcn2; +=C2=A0=C2=A0 =C2=A0u64 sectors, clusters, mlcn, mlcn2, dev_size0; =C2=A0=C2=A0=C2=A0 =C2=A0struct NTFS_BOOT *boot; =C2=A0=C2=A0=C2=A0 =C2=A0struct buffer_head *bh; =C2=A0=C2=A0=C2=A0 =C2=A0struct MFT_REC *rec; @@ -855,6 +855,9 @@ static int ntfs_init_from_boot(struct super_block=20 *sb, u32 sector_size, =C2=A0=C2=A0=C2=A0 =C2=A0u32 boot_off =3D 0; =C2=A0=C2=A0=C2=A0 =C2=A0const char *hint =3D "Primary boot"; +=C2=A0=C2=A0 =C2=A0/* Save original dev_size. Used with alternative boot. = */ +=C2=A0=C2=A0 =C2=A0dev_size0 =3D dev_size; + =C2=A0=C2=A0=C2=A0 =C2=A0sbi->volume.blocks =3D dev_size >> PAGE_SHIFT; =C2=A0=C2=A0=C2=A0 =C2=A0bh =3D ntfs_bread(sb, 0); @@ -1087,9 +1090,9 @@ static int ntfs_init_from_boot(struct super_block=20 *sb, u32 sector_size, =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0out: -=C2=A0=C2=A0 =C2=A0if (err =3D=3D -EINVAL && !bh->b_blocknr && dev_size > = PAGE_SHIFT) { +=C2=A0=C2=A0 =C2=A0if (err =3D=3D -EINVAL && !bh->b_blocknr && dev_size0 >= PAGE_SHIFT) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0u32 block_size =3D min_t(u32, = sector_size, PAGE_SIZE); -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0u64 lbo =3D dev_size - sizeof(*boot); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0u64 lbo =3D dev_size0 - sizeof(*boot= ); =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 * Try alternative boot (last= sector) @@ -1103,6 +1106,7 @@ static int ntfs_init_from_boot(struct super_block=20 *sb, u32 sector_size, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0boot_off =3D lbo & (block_size= - 1); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0hint =3D "Alternative boot"; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0dev_size =3D dev_size0; /* restore o= riginal size. */ =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto check_boot; =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0=C2=A0=C2=A0 =C2=A0brelse(bh); --=20 2.34.1 From nobody Fri Dec 19 22:05:53 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 A81A7E7D272 for ; Tue, 26 Sep 2023 09:56:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233665AbjIZJ4j (ORCPT ); Tue, 26 Sep 2023 05:56:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231182AbjIZJ4Z (ORCPT ); Tue, 26 Sep 2023 05:56:25 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDE5D136; Tue, 26 Sep 2023 02:56:18 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 85E7D21BC; Tue, 26 Sep 2023 09:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721826; bh=T9vkfkHcNvq5d6thJXCI0YPqyqz/uUcgdijYO65TaHI=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=dNKcbWWY4JBplqmHwYV1MO3bNpKVXPJ6gu7Kq4kobN7Ue7QKfFrCtHszoJbQY2W9B wj4WQTHy9EJl7MTokBKsui/7JOZn6BU4bQNh3D5oKEqlHeZy9xS2M2g1Pw19OSnxPr 3nXnDyxOjxgsyIb2+jOuIUHSbHTwKyN/mklkX9ec= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id CF4DB2196; Tue, 26 Sep 2023 09:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695722176; bh=T9vkfkHcNvq5d6thJXCI0YPqyqz/uUcgdijYO65TaHI=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=DcUNAJblr1CcjhmuYcHUghgHIbUu8CxaGNbF3lNDg/GZvhDdOLtng6d9QG580euDq 6fv+QREl/Gcd2yUE0uGTka6RDW54edlYTvctMbKKYg1Tfre0wYrBhOmY1f89CH1HUP kyezymUxjGGk9z+VwOthc36L0cDNBdz2C3aP24XA= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:56:16 +0300 Message-ID: <1c6bcea6-3d7a-4f01-ae67-fab917344a00@paragon-software.com> Date: Tue, 26 Sep 2023 12:56:16 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 4/8] fs/ntfs3: Refactoring and comments Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.211.137] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) 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/attrib.c=C2=A0 |=C2=A0 6 +++--- =C2=A0fs/ntfs3/file.c=C2=A0=C2=A0=C2=A0 |=C2=A0 4 ++-- =C2=A0fs/ntfs3/inode.c=C2=A0=C2=A0 |=C2=A0 3 ++- =C2=A0fs/ntfs3/namei.c=C2=A0=C2=A0 |=C2=A0 6 +++--- =C2=A0fs/ntfs3/ntfs.h=C2=A0=C2=A0=C2=A0 |=C2=A0 2 +- =C2=A0fs/ntfs3/ntfs_fs.h |=C2=A0 2 -- =C2=A0fs/ntfs3/record.c=C2=A0 |=C2=A0 6 ++++++ =C2=A0fs/ntfs3/super.c=C2=A0=C2=A0 | 19 ++++++++----------- =C2=A08 files changed, 25 insertions(+), 23 deletions(-) diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index a9d82bbb4729..e16487764282 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -1106,10 +1106,10 @@ int attr_data_get_block(struct ntfs_inode *ni,=20 CLST vcn, CLST clen, CLST *lcn, =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=C2=A0=C2=A0 =C2=A0 * The code below may require additional cluster = (to extend=20 attribute list) -=C2=A0=C2=A0 =C2=A0 * and / or one MFT record -=C2=A0=C2=A0 =C2=A0 * It is too complex to undo operations if -ENOSPC occu= rs deep inside +=C2=A0=C2=A0 =C2=A0 * and / or one MFT record +=C2=A0=C2=A0 =C2=A0 * It is too complex to undo operations if -ENOSPC occu= rs deep inside =C2=A0=C2=A0=C2=A0 =C2=A0 * in 'ni_insert_nonresident'. =C2=A0=C2=A0=C2=A0 =C2=A0 * Return in advance -ENOSPC here if there are no= free cluster and=20 no free MFT. =C2=A0=C2=A0=C2=A0 =C2=A0 */ diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index 962f12ce6c0a..1f7a194983c5 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -745,8 +745,8 @@ static ssize_t ntfs_file_read_iter(struct kiocb=20 *iocb, struct iov_iter *iter) =C2=A0} =C2=A0static ssize_t ntfs_file_splice_read(struct file *in, loff_t *ppos, -=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 struct pipe_inode_info *pipe, -=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 size_t len, unsigned int flags) +=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 struct pipe_inode_info *pipe, size_t len, +=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 unsigned int flags) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0struct inode *inode =3D in->f_mapping->host; =C2=A0=C2=A0=C2=A0 =C2=A0struct ntfs_inode *ni =3D ntfs_i(inode); diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 2f76dc055c1f..d6d021e19aaa 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1660,7 +1660,8 @@ struct inode *ntfs_create_inode(struct mnt_idmap=20 *idmap, struct inode *dir, =C2=A0=C2=A0=C2=A0 =C2=A0d_instantiate(dentry, inode); =C2=A0=C2=A0=C2=A0 =C2=A0/* Set original time. inode times (i_ctime) may b= e changed in=20 ntfs_init_acl. */ -=C2=A0=C2=A0 =C2=A0inode->i_atime =3D inode->i_mtime =3D inode_set_ctime_t= o_ts(inode,=20 ni->i_crtime); +=C2=A0=C2=A0 =C2=A0inode->i_atime =3D inode->i_mtime =3D +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0inode_set_ctime_to_ts(inode, ni->i_c= rtime); =C2=A0=C2=A0=C2=A0 =C2=A0dir->i_mtime =3D inode_set_ctime_to_ts(dir, ni->i= _crtime); =C2=A0=C2=A0=C2=A0 =C2=A0mark_inode_dirty(dir); diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c index ad430d50bd79..eedacf94edd8 100644 --- a/fs/ntfs3/namei.c +++ b/fs/ntfs3/namei.c @@ -156,8 +156,8 @@ static int ntfs_link(struct dentry *ode, struct=20 inode *dir, struct dentry *de) =C2=A0=C2=A0=C2=A0 =C2=A0err =3D ntfs_link_inode(inode, de); =C2=A0=C2=A0=C2=A0 =C2=A0if (!err) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0dir->i_mtime =3D inode_set_ctime_to_= ts(inode, -=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=C2=A0=C2=A0=C2=A0=C2=A0 inode_set= _ctime_current(dir)); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0dir->i_mtime =3D inode_set_ctime_to_= ts( +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0inode, inode_set_= ctime_current(dir)); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0mark_inode_dirty(inode); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0mark_inode_dirty(dir); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0d_instantiate(de, inode); @@ -373,7 +373,7 @@ static int ntfs_atomic_open(struct inode *dir,=20 struct dentry *dentry, =C2=A0#ifdef CONFIG_NTFS3_FS_POSIX_ACL =C2=A0=C2=A0=C2=A0 =C2=A0if (IS_POSIXACL(dir)) { -=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 =C2=A0 * Load in cache current acl t= o avoid ni_lock(dir): =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 * ntfs_create_inode -> ntfs_i= nit_acl -> posix_acl_create -> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 * ntfs_get_acl -> ntfs_get_ac= l_ex -> ni_lock diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h index 98b76d1b09e7..86aecbb01a92 100644 --- a/fs/ntfs3/ntfs.h +++ b/fs/ntfs3/ntfs.h @@ -847,7 +847,7 @@ struct OBJECT_ID { =C2=A0=C2=A0=C2=A0 =C2=A0// Birth Volume Id is the Object Id of the Volume= on. =C2=A0=C2=A0=C2=A0 =C2=A0// which the Object Id was allocated. It never ch= anges. =C2=A0=C2=A0=C2=A0 =C2=A0struct GUID BirthVolumeId; //0x10: - + =C2=A0=C2=A0=C2=A0 =C2=A0// Birth Object Id is the first Object Id that was =C2=A0=C2=A0=C2=A0 =C2=A0// ever assigned to this MFT Record. I.e. If the = Object Id =C2=A0=C2=A0=C2=A0 =C2=A0// is changed for some reason, this field will re= flect the diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 788567d71d93..0e6a2777870c 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -497,8 +497,6 @@ int ntfs_getattr(struct mnt_idmap *idmap, const=20 struct path *path, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 struct kstat *stat, u32 reque= st_mask, u32 flags); =C2=A0int ntfs3_setattr(struct mnt_idmap *idmap, struct dentry *dentry, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 struct iattr *attr); -void ntfs_sparse_cluster(struct inode *inode, struct page *page0, CLST vcn, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 CLST len); =C2=A0int ntfs_file_open(struct inode *inode, struct file *file); =C2=A0int ntfs_fiemap(struct inode *inode, struct fiemap_extent_info *fiei= nfo, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0__u64 start, __u64 len); diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c index 02cc91ed8835..53629b1f65e9 100644 --- a/fs/ntfs3/record.c +++ b/fs/ntfs3/record.c @@ -189,6 +189,12 @@ int mi_read(struct mft_inode *mi, bool is_mft) =C2=A0=C2=A0=C2=A0 =C2=A0return err; =C2=A0} +/* + * mi_enum_attr - start/continue attributes enumeration in record. + * + * NOTE: mi->mrec - memory of size sbi->record_size + * here we sure that mi->mrec->total =3D=3D sbi->record_size (see mi_read) + */ =C2=A0struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *att= r) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0const struct MFT_REC *rec =3D mi->mrec; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index d2951b23f52a..f9a214367113 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -488,7 +488,6 @@ static ssize_t ntfs3_label_write(struct file *file,=20 const char __user *buffer, =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0int err; =C2=A0=C2=A0=C2=A0 =C2=A0struct super_block *sb =3D pde_data(file_inode(fi= le)); -=C2=A0=C2=A0 =C2=A0struct ntfs_sb_info *sbi =3D sb->s_fs_info; =C2=A0=C2=A0=C2=A0 =C2=A0ssize_t ret =3D count; =C2=A0=C2=A0=C2=A0 =C2=A0u8 *label =3D kmalloc(count, GFP_NOFS); @@ -502,7 +501,7 @@ static ssize_t ntfs3_label_write(struct file *file,=20 const char __user *buffer, =C2=A0=C2=A0=C2=A0 =C2=A0while (ret > 0 && label[ret - 1] =3D=3D '\n') =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ret -=3D 1; -=C2=A0=C2=A0 =C2=A0err =3D ntfs_set_label(sbi, label, ret); +=C2=A0=C2=A0 =C2=A0err =3D ntfs_set_label(sb->s_fs_info, label, ret); =C2=A0=C2=A0=C2=A0 =C2=A0if (err < 0) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ntfs_err(sb, "failed (%d) to w= rite label", err); @@ -1082,10 +1081,10 @@ static int ntfs_init_from_boot(struct=20 super_block *sb, u32 sector_size, =C2=A0=C2=A0=C2=A0 =C2=A0if (bh->b_blocknr && !sb_rdonly(sb)) { =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 * Alternative boot is ok but p= rimary is not ok. -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * Do not update primary boot h= ere 'cause it may be faked boot. -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * Let ntfs to be mounted and u= pdate boot later. -=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 * Alternative boot is ok but prima= ry is not ok. +=C2=A0=C2=A0 =C2=A0 =C2=A0=C2=A0 =C2=A0 * Do not update primary boot here = 'cause it may be faked boot. +=C2=A0=C2=A0 =C2=A0 =C2=A0=C2=A0 =C2=A0 * Let ntfs to be mounted and updat= e boot later. +=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*boot2 =3D kmemdup(boot, sizeo= f(*boot), GFP_NOFS | __GFP_NOWARN); =C2=A0=C2=A0=C2=A0 =C2=A0} @@ -1549,9 +1548,9 @@ static int ntfs_fill_super(struct super_block *sb,=20 struct fs_context *fc) =C2=A0=C2=A0=C2=A0 =C2=A0if (boot2) { =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 * Alternative boot is ok but p= rimary is not ok. -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * Volume is recognized as NTFS= . Update primary boot. -=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 * Alternative boot is ok but prima= ry is not ok. +=C2=A0=C2=A0 =C2=A0 =C2=A0=C2=A0 =C2=A0 * Volume is recognized as NTFS. Up= date primary boot. +=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=A0struct buffer_head *bh0 =3D sb= _getblk(sb, 0); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (bh0) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (buffer_= locked(bh0)) @@ -1785,7 +1784,6 @@ static int __init init_ntfs_fs(void) =C2=A0=C2=A0=C2=A0 =C2=A0if (IS_ENABLED(CONFIG_NTFS3_LZX_XPRESS)) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0pr_info("ntfs3: Read-only LZX/= Xpress compression included\n"); - =C2=A0#ifdef CONFIG_PROC_FS =C2=A0=C2=A0=C2=A0 =C2=A0/* Create "/proc/fs/ntfs3" */ =C2=A0=C2=A0=C2=A0 =C2=A0proc_info_root =3D proc_mkdir("fs/ntfs3", NULL); @@ -1827,7 +1825,6 @@ static void __exit exit_ntfs_fs(void) =C2=A0=C2=A0=C2=A0 =C2=A0if (proc_info_root) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0remove_proc_entry("fs/ntfs3", = NULL); =C2=A0#endif - =C2=A0} =C2=A0MODULE_LICENSE("GPL"); --=20 2.34.1 From nobody Fri Dec 19 22:05:53 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 650AAE7D271 for ; Tue, 26 Sep 2023 09:56:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234308AbjIZJ4v (ORCPT ); Tue, 26 Sep 2023 05:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234133AbjIZJ4q (ORCPT ); Tue, 26 Sep 2023 05:56:46 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E31CBBE; Tue, 26 Sep 2023 02:56:39 -0700 (PDT) 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 BC5B521BC; Tue, 26 Sep 2023 09:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721847; bh=M2FK5gsLtmNBcSaysRw/Y++y3lLBnCCRyRI6dXE7TkE=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=XHUt8KfYdRnPQjP75T3mvqKkT0lKFp8HuLuslcCVkw0uxFL6JlAkifzksCkkJ+n6b fGCHjdm03L0Nyu6du7YjamOBFvCO3Xq2r9hGvMnVe3dtDl+oQDaQN6PD6h+sPHeEtO +153iHrxH+T8LNfgdd1PmaaaOziZj5/1Qrq1wvtA= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:56:37 +0300 Message-ID: <0b667ec4-8223-407b-9303-94b70dfa5101@paragon-software.com> Date: Tue, 26 Sep 2023 12:56:37 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 5/8] fs/ntfs3: Add more info into /proc/fs/ntfs3//volinfo Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.211.137] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) 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/super.c | 14 +++++++++++--- =C2=A01 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index f9a214367113..5811da7e9d45 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -453,15 +453,23 @@ static struct proc_dir_entry *proc_info_root; =C2=A0 * ntfs3.1 =C2=A0 * cluster size =C2=A0 * number of clusters + * total number of mft records + * number of used mft records ~=3D number of files + folders + * real state of ntfs "dirty"/"clean" + * current state of ntfs "dirty"/"clean" =C2=A0*/ =C2=A0static int ntfs3_volinfo(struct seq_file *m, void *o) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0struct super_block *sb =3D m->private; =C2=A0=C2=A0=C2=A0 =C2=A0struct ntfs_sb_info *sbi =3D sb->s_fs_info; -=C2=A0=C2=A0 =C2=A0seq_printf(m, "ntfs%d.%d\n%u\n%zu\n", sbi->volume.major= _ver, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 sbi->volume.minor_ver, = sbi->cluster_size, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 sbi->used.bitmap.nbits); +=C2=A0=C2=A0 =C2=A0seq_printf(m, "ntfs%d.%d\n%u\n%zu\n\%zu\n%zu\n%s\n%s\n", +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 sbi->volume.major_ver, = sbi->volume.minor_ver, +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 sbi->cluster_size, sbi-= >used.bitmap.nbits, +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 sbi->mft.bitmap.nbits, +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 sbi->mft.bitmap.nbits -= wnd_zeroes(&sbi->mft.bitmap), +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 sbi->volume.real_dirty = ? "dirty" : "clean", +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (sbi->volume.flags & VO= LUME_FLAG_DIRTY) ? "dirty" : "clean"); =C2=A0=C2=A0=C2=A0 =C2=A0return 0; =C2=A0} --=20 2.34.1 From nobody Fri Dec 19 22:05:53 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 D8FECE7D272 for ; Tue, 26 Sep 2023 09:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234323AbjIZJ5H (ORCPT ); Tue, 26 Sep 2023 05:57:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbjIZJ5E (ORCPT ); Tue, 26 Sep 2023 05:57:04 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08CA0FB; Tue, 26 Sep 2023 02:56:57 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id CB48421BC; Tue, 26 Sep 2023 09:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721865; bh=OjduOup+un8qGaTqAgDN4qohzpVoBogSKK/pi3uPgl8=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=HIMyLl9rMNTvWGANMBZ7k7mSFx743msYy8g+KbPRc35kVUui5Qgd+JfssKRCUF0ui twFYLxmtFfDFAjRcjxfXt7yN2F40dZVbX0JZVnAdS7CdKYjqrjG57x/xHjmQyQ4UVE zk0O+hx243YtYUWyghzeculoR16Cnf+FVRwSwCzI= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id 2631B1D45; Tue, 26 Sep 2023 09:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695722216; bh=OjduOup+un8qGaTqAgDN4qohzpVoBogSKK/pi3uPgl8=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=QXyZoO1bXsfpERWazQ/dHI//s8xiRczuXczn4XUZ56rPoO9HfV38ePAekMdcfaUY/ OyxcUmV7lg8D7Gw1Pc4+Gy3RKFwS6bD/9xb0nDoIQSlMoF+6JWb0mRW1zu4YHVxG2f x3S2MWJGobvAR2nlXUBUY6T0kBtzEYQMktPSZHeo= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:56:55 +0300 Message-ID: <4fdb4c65-d6db-4a0c-b2cc-296646c1e1fe@paragon-software.com> Date: Tue, 26 Sep 2023 12:56:55 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 6/8] fs/ntfs3: Do not allow to change label if volume is read-only Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.211.137] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) 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/super.c | 7 ++++++- =C2=A01 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 5811da7e9d45..cf0a720523f0 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -497,7 +497,12 @@ static ssize_t ntfs3_label_write(struct file *file,=20 const char __user *buffer, =C2=A0=C2=A0=C2=A0 =C2=A0int err; =C2=A0=C2=A0=C2=A0 =C2=A0struct super_block *sb =3D pde_data(file_inode(fi= le)); =C2=A0=C2=A0=C2=A0 =C2=A0ssize_t ret =3D count; -=C2=A0=C2=A0 =C2=A0u8 *label =3D kmalloc(count, GFP_NOFS); +=C2=A0=C2=A0 =C2=A0u8 *label; + +=C2=A0=C2=A0 =C2=A0if (sb_rdonly(sb)) +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0return -EROFS; + +=C2=A0=C2=A0 =C2=A0label =3D kmalloc(count, GFP_NOFS); =C2=A0=C2=A0=C2=A0 =C2=A0if (!label) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0return -ENOMEM; --=20 2.34.1 From nobody Fri Dec 19 22:05:53 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 DB0FCE7D270 for ; Tue, 26 Sep 2023 09:57:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234341AbjIZJ52 (ORCPT ); Tue, 26 Sep 2023 05:57:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234332AbjIZJ5X (ORCPT ); Tue, 26 Sep 2023 05:57:23 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7055E180; Tue, 26 Sep 2023 02:57:16 -0700 (PDT) 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 D74CD21BC; Tue, 26 Sep 2023 09:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721883; bh=bm/OuTb2k1SKktIcvNOfnXcU6zkoYgiSC7bYVh+F8wM=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=LFKbUDezPewix3D97fm/Cu+G0YjuJU15KhAJ0g5GOkGfyPwZk35Rq51MGSp46698H ftYL9HxtU9bsc6ixQLJ/8BR9nwgZ0+V1O/VHVo5M65Vh4B2dDDGK0CXf+oaBCqT5dx E8AN+uc2Kx/Hz5PGxBz1iEuf606qJPfzRRHM2PT0= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:57:13 +0300 Message-ID: Date: Tue, 26 Sep 2023 12:57:13 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 7/8] fs/ntfs3: Fix possible NULL-ptr-deref in ni_readpage_cmpr() Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.211.137] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) 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/frecord.c | 2 +- =C2=A01 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index d49fbb22bd5e..dad976a68985 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -2148,7 +2148,7 @@ int ni_readpage_cmpr(struct ntfs_inode *ni, struct=20 page *page) =C2=A0=C2=A0=C2=A0 =C2=A0for (i =3D 0; i < pages_per_frame; i++) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0pg =3D pages[i]; -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (i =3D=3D idx) +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (i =3D=3D idx || !pg) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0continue; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0unlock_page(pg); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0put_page(pg); --=20 2.34.1 From nobody Fri Dec 19 22:05:53 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 9300DE7D270 for ; Tue, 26 Sep 2023 09:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234414AbjIZJ55 (ORCPT ); Tue, 26 Sep 2023 05:57:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234332AbjIZJ5r (ORCPT ); Tue, 26 Sep 2023 05:57:47 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A43C112A; Tue, 26 Sep 2023 02:57:41 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 5441221BC; Tue, 26 Sep 2023 09:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721909; bh=s8rZE6xcXKLHN8Ppy7AnwtG+R/usQmbqqKjeBuQwDZY=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=MHDIJ4AtXPOYLBeeoxB4jBb4KS/F5sja/tP5M1Rk6+iGEasCpT2S+bzvb0xAzDAtq Nq3ZKXuwHJeXFcd9dzFSFbPoD+f5kINThcXzrnnA5rKEKnYxeTiIgUR4Hv2Omp6rWr jvJ3sFLzT7cAF5kYDQtBdiF+K/JU4AYeFJ9Q8XRo= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id 9B4441D45; Tue, 26 Sep 2023 09:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695722259; bh=s8rZE6xcXKLHN8Ppy7AnwtG+R/usQmbqqKjeBuQwDZY=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=k2j+Lznppxo8BnNnw8gXtJjteGBTL1nm9pTMCmJptbhGLpSsJj26Gx+TzdfQrC9RI eOS0UGpEdLfWQJC9SluMmDby71fahpUEX9I3L7zWFCsep/GTylbiwKZSYvrfuwW1Pl Yy1CN7MyAIBSIbAbhHgBZzpi17B4YQdBFf14nOQI= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:57:39 +0300 Message-ID: Date: Tue, 26 Sep 2023 12:57:39 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 8/8] fs/ntfs3: Fix NULL pointer dereference on error in attr_allocate_frame() Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.211.137] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) 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/attrib.c | 6 ++---- =C2=A01 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index e16487764282..63f70259edc0 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -1736,10 +1736,8 @@ int attr_allocate_frame(struct ntfs_inode *ni,=20 CLST frame, size_t compr_size, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0le_b =3D NU= LL; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0attr_b =3D = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL, =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=C2=A0=C2=A0=C2=A0 0, NULL, &mi_b); -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (!attr_b) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0err =3D -ENOENT; -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0goto out; -=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=A0if (!attr_b) +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0return -ENOENT; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0attr =3D at= tr_b; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0le =3D le_b; --=20 2.34.1