From patchwork Fri Jun 7 12:15:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689798 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC680190672; Fri, 7 Jun 2024 12:21:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762876; cv=none; b=ddp/T+L9nolHrYhayFNSlJW9KCJHUZgGH7L6FGa+rtJW7/wMhUX5Cp+BFlSk8xkrvzj4J6I3SK9xS1bm0DEoTra0k3kWuRA6BTSepm5kTW2snUoTMzzUGMH5jasRmAnxphNWMJebv1QQplgeT5g+qHKLoFb85GRBsbD+yQg7U5k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762876; c=relaxed/simple; bh=y6qWtrpkZqusAAapvB5X4IkDLdvvSpaWslGRSO8ceWs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RZLYU2n1Z3RxvoYxmWVsyTbwVAr2KvJqh22m2a5A3Xu4ONjQyxP9hSddYr1D3jQvcpcN8cUbeLTfXGd1Pn5QCGMhSgqCqw8bW8tErNvON2Ln87mBiiZ1n5Zr0Z8rQNL9gOvwa1AgKeUWPoka3/FxJIMxqTMDKh1x1cTLeTJvU58= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=iab/r7sh; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=WCklOibq; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="iab/r7sh"; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="WCklOibq" Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 7783F20F5; Fri, 7 Jun 2024 12:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762090; bh=ieQyW4z66ZKq7WPGZB3WJThiQlHeD3ZBUU4O1S8w13s=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=iab/r7shxZyQcEZAZhvreSkg/ZGQn4CL76lO4lkbkJyhuybFXLA/+IhZ3CAc+t8GX QG0cQB2szYLpaWxDUt5vEgowTo7cJqk3HPu6Dit2GeKoqfal/i5Kvjm5OhUGXagNGD Vxb28F9WTsGGB6z7iY0fHNoHd+zYoyLsVR/U/f8A= 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 5979A195; Fri, 7 Jun 2024 12:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762564; bh=ieQyW4z66ZKq7WPGZB3WJThiQlHeD3ZBUU4O1S8w13s=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=WCklOibqwPSdIbcMRQNVCfzy9nhwd48pD81SaZ3CajC+WPoic8oO7TgIwXEgTHCU8 dwaWBiMrVBLd7ne+8s8exygyJChsN4xg5onItl8aq35xv/Gbll2taT0M6mOzyreUSA 4wkc6UzrUxZEFfj38yIwuPYTIejd250CwZm3elOY= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:03 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 01/18] fs/ntfs3: Remove unused function Date: Fri, 7 Jun 2024 15:15:31 +0300 Message-ID: <20240607121548.18818-2-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) At the moment, the function turned out to be unused, so I removed it. Signed-off-by: Konstantin Komarov --- fs/ntfs3/inode.c | 30 ------------------------------ fs/ntfs3/ntfs_fs.h | 1 - 2 files changed, 31 deletions(-) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 0f1664db94ad..6dc51faeef8d 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1097,36 +1097,6 @@ int ntfs_flush_inodes(struct super_block *sb, struct inode *i1, return ret; } -int inode_write_data(struct inode *inode, const void *data, size_t bytes) -{ - pgoff_t idx; - - /* Write non resident data. */ - for (idx = 0; bytes; idx++) { - size_t op = bytes > PAGE_SIZE ? PAGE_SIZE : bytes; - struct page *page = ntfs_map_page(inode->i_mapping, idx); - - if (IS_ERR(page)) - return PTR_ERR(page); - - lock_page(page); - WARN_ON(!PageUptodate(page)); - ClearPageUptodate(page); - - memcpy(page_address(page), data, op); - - flush_dcache_page(page); - SetPageUptodate(page); - unlock_page(page); - - ntfs_unmap_page(page); - - bytes -= op; - data = Add2Ptr(data, PAGE_SIZE); - } - return 0; -} - /* * ntfs_reparse_bytes * diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index f9ed6d2b065d..ee0c1b76e812 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -716,7 +716,6 @@ int ntfs3_write_inode(struct inode *inode, struct writeback_control *wbc); int ntfs_sync_inode(struct inode *inode); int ntfs_flush_inodes(struct super_block *sb, struct inode *i1, struct inode *i2); -int inode_write_data(struct inode *inode, const void *data, size_t bytes); int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry, const struct cpu_str *uni, umode_t mode, dev_t dev, const char *symname, u32 size, From patchwork Fri Jun 7 12:15:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689799 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D29DF15B127; Fri, 7 Jun 2024 12:21:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762877; cv=none; b=m+JCEmZDKC0ETTMsKf2qjed6kSaxUKwN8zO4uOL8QveC6PV51EczXfk09seFEIRq/zQfau0a8kAppc/WsWpWqIDlcrZSQFVYPNkPFzKq7kyJ2jFq+PAJSzd5SnEyfduYCEKMZOmS8gSzoNy2seYyDiL10dOFIPwXnlZMzEjkLbw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762877; c=relaxed/simple; bh=J6KPuZ2VxItqZmJdi4nQDQNER33qNxybVV6F+t0nrao=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jByU0HlrMs+cYnTd8a1wzKB/zdke7UNZPS03cyjv+XmqtybTDp/ftLT27buMzijAfiaw1nXJEMhrU3mVewEheTuIY3vZRnNnp3Em9ESfBxfZLvAl5krom2dUq4tUT/KEhuBfhM9sJ0pFCSkDp2oK/sdETOBvBDCPmbMAhxIjObk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=QrBgp6qI; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="QrBgp6qI" 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 ABBA720FF; Fri, 7 Jun 2024 12:08:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762091; bh=GaStLi+0wBM9tYp9G17MLO5l7cW1O7P/lNN8XAy/iCs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=QrBgp6qIbln4ZrPCCqQEz4pKb2V85OCBgT80EIrWad4iz5GuhJzrQIKjpwanfzub/ R86lsncvALbmlnjFnSt+uHqqHLLgZQF+yyzRiPnQYbM68vhNo/e73uHXxlUGRLsU76 GX6ljmhAxqHUWXfVVpsJ71odO+F2CJqsYTuBK9Og= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:05 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 02/18] fs/ntfs3: Simplify initialization of $AttrDef and $UpCase Date: Fri, 7 Jun 2024 15:15:32 +0300 Message-ID: <20240607121548.18818-3-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Replaced the two loops reading $AttrDef and $UpCase with the inode_read_data() function. Signed-off-by: Konstantin Komarov --- fs/ntfs3/inode.c | 28 ++++++++++++++++++++++ fs/ntfs3/ntfs_fs.h | 17 +------------ fs/ntfs3/super.c | 60 ++++++++++++++++++---------------------------- 3 files changed, 52 insertions(+), 53 deletions(-) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 6dc51faeef8d..2a3522bbeeb4 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1097,6 +1097,34 @@ int ntfs_flush_inodes(struct super_block *sb, struct inode *i1, return ret; } +/* + * Helper function to read file. + */ +int inode_read_data(struct inode *inode, void *data, size_t bytes) +{ + pgoff_t idx; + struct address_space *mapping = inode->i_mapping; + + for (idx = 0; bytes; idx++) { + size_t op = bytes > PAGE_SIZE ? PAGE_SIZE : bytes; + struct page *page = read_mapping_page(mapping, idx, NULL); + void *kaddr; + + if (IS_ERR(page)) + return PTR_ERR(page); + + kaddr = kmap_atomic(page); + memcpy(data, kaddr, op); + kunmap_atomic(kaddr); + + put_page(page); + + bytes -= op; + data = Add2Ptr(data, PAGE_SIZE); + } + return 0; +} + /* * ntfs_reparse_bytes * diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index ee0c1b76e812..3583d47b95da 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -716,6 +716,7 @@ int ntfs3_write_inode(struct inode *inode, struct writeback_control *wbc); int ntfs_sync_inode(struct inode *inode); int ntfs_flush_inodes(struct super_block *sb, struct inode *i1, struct inode *i2); +int inode_read_data(struct inode *inode, void *data, size_t bytes); int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry, const struct cpu_str *uni, umode_t mode, dev_t dev, const char *symname, u32 size, @@ -909,22 +910,6 @@ static inline bool ntfs_is_meta_file(struct ntfs_sb_info *sbi, CLST rno) rno == sbi->usn_jrnl_no; } -static inline void ntfs_unmap_page(struct page *page) -{ - kunmap(page); - put_page(page); -} - -static inline struct page *ntfs_map_page(struct address_space *mapping, - unsigned long index) -{ - struct page *page = read_mapping_page(mapping, index, NULL); - - if (!IS_ERR(page)) - kmap(page); - return page; -} - static inline size_t wnd_zone_bit(const struct wnd_bitmap *wnd) { return wnd->zone_bit; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 27fbde2701b6..6c9e5fe8ce81 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -1163,7 +1163,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) CLST vcn, lcn, len; struct ATTRIB *attr; const struct VOLUME_INFO *info; - u32 idx, done, bytes; + u32 done, bytes; struct ATTR_DEF_ENTRY *t; u16 *shared; struct MFT_REF ref; @@ -1435,31 +1435,22 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) goto put_inode_out; } - for (done = idx = 0; done < bytes; done += PAGE_SIZE, idx++) { - unsigned long tail = bytes - done; - struct page *page = ntfs_map_page(inode->i_mapping, idx); + /* Read the entire file. */ + err = inode_read_data(inode, sbi->def_table, bytes); + if (err) { + ntfs_err(sb, "Failed to read $AttrDef (%d).", err); + goto put_inode_out; + } - if (IS_ERR(page)) { - err = PTR_ERR(page); - ntfs_err(sb, "Failed to read $AttrDef (%d).", err); - goto put_inode_out; - } - memcpy(Add2Ptr(t, done), page_address(page), - min(PAGE_SIZE, tail)); - ntfs_unmap_page(page); - - if (!idx && ATTR_STD != t->type) { - ntfs_err(sb, "$AttrDef is corrupted."); - err = -EINVAL; - goto put_inode_out; - } + if (ATTR_STD != t->type) { + ntfs_err(sb, "$AttrDef is corrupted."); + err = -EINVAL; + goto put_inode_out; } t += 1; sbi->def_entries = 1; done = sizeof(struct ATTR_DEF_ENTRY); - sbi->reparse.max_size = MAXIMUM_REPARSE_DATA_BUFFER_SIZE; - sbi->ea_max_size = 0x10000; /* default formatter value */ while (done + sizeof(struct ATTR_DEF_ENTRY) <= bytes) { u32 t32 = le32_to_cpu(t->type); @@ -1495,27 +1486,22 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) goto put_inode_out; } - for (idx = 0; idx < (0x10000 * sizeof(short) >> PAGE_SHIFT); idx++) { - const __le16 *src; - u16 *dst = Add2Ptr(sbi->upcase, idx << PAGE_SHIFT); - struct page *page = ntfs_map_page(inode->i_mapping, idx); - - if (IS_ERR(page)) { - err = PTR_ERR(page); - ntfs_err(sb, "Failed to read $UpCase (%d).", err); - goto put_inode_out; - } - - src = page_address(page); + /* Read the entire file. */ + err = inode_read_data(inode, sbi->upcase, 0x10000 * sizeof(short)); + if (err) { + ntfs_err(sb, "Failed to read $UpCase (%d).", err); + goto put_inode_out; + } #ifdef __BIG_ENDIAN - for (i = 0; i < PAGE_SIZE / sizeof(u16); i++) + { + const __le16 *src = sbi->upcase; + u16 *dst = sbi->upcase; + + for (i = 0; i < 0x10000; i++) *dst++ = le16_to_cpu(*src++); -#else - memcpy(dst, src, PAGE_SIZE); -#endif - ntfs_unmap_page(page); } +#endif shared = ntfs_set_shared(sbi->upcase, 0x10000 * sizeof(short)); if (shared && sbi->upcase != shared) { From patchwork Fri Jun 7 12:15:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689810 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DB5E1922F2; Fri, 7 Jun 2024 12:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717763177; cv=none; b=RqIFPx6LS2+s99y1g6ccHfcsKvBM3U1fvv9DToKeIT6soUbgfddG//S178gc80aKkTTmyRINPxxkt3l0SzqcthWhdKMFgsDPlNSv2iICKhBKXhwf9MxLssHIw9pQ23sSRAMCdi920jaLj4WXL3N7WTcLS9yyJ0HJa4PuV/HUHXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717763177; c=relaxed/simple; bh=Qftod05FG8cvV0DSzaUmUcM0W3C99UwJOo6+6K5E5Q0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OT1qXnBSi0xSSGz/RhI6yFgOrmiSd1+FnfxsgeWF8Ym+I1kL4IiTSV8ZZtCGArNhIIweWsbETqWzY0J+IjTOKRyYgnPYRY+u8K6K0qEe3iQTwkCf8THAjEu86XHhsY6NlVE11B0w6xfEAT29L6S3Be2CN1dOBN/LXihgMQxkpmA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=pciVf6Lh; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=Rtx/WFi/; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="pciVf6Lh"; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="Rtx/WFi/" Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id A986C210F; Fri, 7 Jun 2024 12:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762093; bh=C0FGKScgnT35/rhseY+g8+MwboIiYrT4rJr94CiH6dY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=pciVf6LhJPjNSSemFdaR0dyVndK7+XIl3Ol5Urwi736uGXEw+YMn1LLC29agSpdgQ HiW2zgOEyemCnAwE2iT3bXnnhUS8Cc4gGkMIVWcUv3pcZRLrGzusnOwnNya84ZwvKN QmnJYKv+QmHVLNthp3kd83AOvQhY2D/nKDCZfKQQ= 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 8D3D7195; Fri, 7 Jun 2024 12:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762567; bh=C0FGKScgnT35/rhseY+g8+MwboIiYrT4rJr94CiH6dY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Rtx/WFi/ykZJaXFGm3HBVjNjkCEEWUQyaucxmFbLNNcTSc+eptRAUchT1VcRMLI4e 49jCBSnBbKXDXQEl/0LoSgDEFTbsYyM+dYNeyMbmwoJavnF82PLaVj9JcZa3hmX5pz Ss2o6UJfeOQllTIonhl3DU54Tu0ZRN/yrKtY/NWc= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:07 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 03/18] fs/ntfs3: Fix transform resident to nonresident for compressed files Date: Fri, 7 Jun 2024 15:15:33 +0300 Message-ID: <20240607121548.18818-4-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Сorrected calculation of required space len (in clusters) for attribute data storage in case of compression. Fixes: be71b5cba2e64 ("fs/ntfs3: Add attrib operations") Signed-off-by: Konstantin Komarov --- fs/ntfs3/attrib.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index 8e6bcdf99770..8638248d80d9 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -231,7 +231,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr, struct ntfs_sb_info *sbi; struct ATTRIB *attr_s; struct MFT_REC *rec; - u32 used, asize, rsize, aoff, align; + u32 used, asize, rsize, aoff; bool is_data; CLST len, alen; char *next; @@ -252,10 +252,13 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr, rsize = le32_to_cpu(attr->res.data_size); is_data = attr->type == ATTR_DATA && !attr->name_len; - align = sbi->cluster_size; - if (is_attr_compressed(attr)) - align <<= COMPRESSION_UNIT; - len = (rsize + align - 1) >> sbi->cluster_bits; + /* len - how many clusters required to store 'rsize' bytes */ + if (is_attr_compressed(attr)) { + u8 shift = sbi->cluster_bits + NTFS_LZNT_CUNIT; + len = ((rsize + (1u << shift) - 1) >> shift) << NTFS_LZNT_CUNIT; + } else { + len = bytes_to_cluster(sbi, rsize); + } run_init(run); From patchwork Fri Jun 7 12:15:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689811 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DAB2190682; Fri, 7 Jun 2024 12:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717763178; cv=none; b=nMtCrsxRQWGX3d69VBmLp/KazkfxaaYyYZjHowuwfDIvWvYKVSnPg1RVw0DRDAG6AtFywId9vXfO6K/lzQO4qbDmoZiXQDmXZ8IcSpJDLF197rEI41pZjRW/vHCIbHi6BppKhY6KwclaHO3PHzgvdmssQj0VdRv2l/LzCnV3nuc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717763178; c=relaxed/simple; bh=9pfPn1DGlgCPQSm1l68MBIhjL6uK0pKgf2XzkNTt120=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lAtFbqMaZhyPQKyKQ9hv/YxM8CB11aD52xzsfH/Lfx9K7FEogkK7S6BR7KUxac/O57UjMavBsWfeX6tY527yOJwytG8TC9DixvA+TT5qd9y7aGjLlPuZyUZlue4Ohc8t8NN1OfvfBGXbvxiuwrzm5fAaDZqxgwWKxMOJIFtvdqk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=MhmQO+3w; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="MhmQO+3w" 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 123A72110; Fri, 7 Jun 2024 12:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762095; bh=hZDgLEF+W6zZWxUzPUdboblkLRtxbcKk/oAVZILB+e4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=MhmQO+3wsHnK5Fg3xzRJt2k9tQH70q/hOnKV5CFtagm4ISB+eVWwYbFLKQiM+aYYn qAswQYHDqS4nrCIYol8JFPNmukVUr4Sycyyr0DWh6tkF+JjCgx4KSneWqlseE/mh7q cUOOhllUs0kF7prHBXYcMk9A0UYoJttTqsZ2G6sQ= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:08 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 04/18] fs/ntfs3: Deny getting attr data block in compressed frame Date: Fri, 7 Jun 2024 15:15:34 +0300 Message-ID: <20240607121548.18818-5-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Attempting to retrieve an attribute data block in a compressed frame is ignored. Fixes: be71b5cba2e64 ("fs/ntfs3: Add attrib operations") Signed-off-by: Konstantin Komarov --- fs/ntfs3/attrib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index 8638248d80d9..7918ab1a3f35 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -975,6 +975,19 @@ int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn, if (err) goto out; + /* Check for compressed frame. */ + err = attr_is_frame_compressed(ni, attr, vcn >> NTFS_LZNT_CUNIT, &hint); + if (err) + goto out; + + if (hint) { + /* if frame is compressed - don't touch it. */ + *lcn = COMPRESSED_LCN; + *len = hint; + err = -EOPNOTSUPP; + goto out; + } + if (!*len) { if (run_lookup_entry(run, vcn, lcn, len, NULL)) { if (*lcn != SPARSE_LCN || !new) From patchwork Fri Jun 7 12:15:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689778 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68DD0186E46; Fri, 7 Jun 2024 12:16:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762573; cv=none; b=BCmQmfYLBGHMpoygOfNOh+h8my1MtzKhmagwj5hMdLzH+fEFjCHzoLCuPbQdCecNALtWUYcQ++HQhlVWX4oGyLO3GSQWyIn+xIPaA2NHUx1Flu1HIcP7g9T6YL4ySvIEsFIX2Kq5CrIOrAJHBL0VPbhw4ZyQ0A4sMFjMBW7ZkDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762573; c=relaxed/simple; bh=YBMNvGaHXBY1iE8bR/ub81+vXUT/4Gibt/hvIi+Vp1M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MGEGuJGtpwC8PBtsSpiIeOEso2homK8FR3jSezWKWjk6zQNVqGopUgGfHACI8puk2aoj5X+MdcqfyBMVk/shreClflA/laVthrvo6YxwO5mJ18o1E/P/gr9p+n7AUpPHlz4jw7BWk+hY3mdu/rbc6FuTqAXVnpcG/JWE6ZFGnKk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=fp0aJiW/; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=The1bojn; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="fp0aJiW/"; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="The1bojn" Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 4089C2111; Fri, 7 Jun 2024 12:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762096; bh=6p1zGEnOfUC6mKbV+PZ9lD9z8S0agv4/5/6Rd6f5BCc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=fp0aJiW/xHJJxTjaEmgIfFd9RpnfHUGE6eGCNRqIRjdVy572F1x3mqoPHmInh/pFR k55F3tbaJDnzmUCxNQr81KpAjFdYPNtkCBN+GfDB5jiGV3klZqFGRiRg1N0xGbdj0w CuxsJ+j377cD8y2QtCJvNthCJu8JbpUlQ8PyTA2E= 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 25341195; Fri, 7 Jun 2024 12:16:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762570; bh=6p1zGEnOfUC6mKbV+PZ9lD9z8S0agv4/5/6Rd6f5BCc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=The1bojn4lSM6xboNjP3TuFw29hQYrvbGbE8M+fvlvP2JS6Q3EJcwzlmrgKooApzd HJVhKvysJiMncfCeHA7sYVFQgXe+T7oNd0BDrzVshP+bpobBql2hrm+0QgZYTfnaUO As1YVQXz6lKyBsVBhigiakGK0kH5J8uGYaix7pqg= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:09 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 05/18] fs/ntfs3: Missed NI_FLAG_UPDATE_PARENT setting Date: Fri, 7 Jun 2024 15:15:35 +0300 Message-ID: <20240607121548.18818-6-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Fixes: be71b5cba2e64 ("fs/ntfs3: Add attrib operations") Signed-off-by: Konstantin Komarov --- fs/ntfs3/attrib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index 7918ab1a3f35..0d13da5523b1 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -1738,6 +1738,7 @@ int attr_allocate_frame(struct ntfs_inode *ni, CLST frame, size_t compr_size, attr_b->nres.total_size = cpu_to_le64(total_size); inode_set_bytes(&ni->vfs_inode, total_size); + ni->ni_flags |= NI_FLAG_UPDATE_PARENT; mi_b->dirty = true; mark_inode_dirty(&ni->vfs_inode); From patchwork Fri Jun 7 12:15:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689779 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E5EC15B0F8; Fri, 7 Jun 2024 12:16:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762575; cv=none; b=NAGuiLOd+kmys8ue6NHWHxTH/KlmMpWmpqCZPz9o+26J1P8/ea9PqleVG+Is1Bl4dtecbMobUybaxaig/PfX2U4ha3eVwPCT6p6T2NhMa8A1JXrsP7Lebqz/uYaMcQE6xSOsgZsHWCNk4E4lFKLiU04WiHtracTsFpyQG9KThmY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762575; c=relaxed/simple; bh=39brRrOkSyHjVx1NS6TpkELccKG+ycIqjB0w7/UFVLY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XSTl+H6s1aQXPuh1TQSyzKDh2Qskvtw/SKVPIU2QGPDfoDXoI+KZuehdmoYwb9km6UTKEQYt8rSSHFKU9ECbgX/rjVYoLpohlqbX2WJiVzwWFnXLylzFy7idMZ9h60wa2qjlGDY6tHncooANlvdknL1TzPZu5suICegfycxMlf8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=H+8aHVOb; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="H+8aHVOb" 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 3E1C22113; Fri, 7 Jun 2024 12:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762097; bh=aobg9M4myEoXktEVGRM+0xcAgpfxxQ9zjd9s/UmvLs8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=H+8aHVObd4lXT/Ta5dL1HBTR62lfD7fXbTMCZarCqU3cCUc04ASL60LAzRYbFYbcv YjKLZtpVFiz20lHjcUHzo8J81EkJ3JABZ2cjbuo5FsABbC5/H08G0IlSV0h6y8GT5/ Io8IyTG7F3xx5C5uQmy5Ia8K4vzZZJn5znp7M3ds= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:10 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 06/18] fs/ntfs3: Fix getting file type Date: Fri, 7 Jun 2024 15:15:36 +0300 Message-ID: <20240607121548.18818-7-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) An additional condition causes the mft record to be read from disk and get the file type dt_type. Fixes: 22457c047ed97 ("fs/ntfs3: Modified fix directory element type detection") Signed-off-by: Konstantin Komarov --- fs/ntfs3/dir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c index 1937e8e612f8..858efe255f6f 100644 --- a/fs/ntfs3/dir.c +++ b/fs/ntfs3/dir.c @@ -326,7 +326,8 @@ static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni, * It does additional locks/reads just to get the type of name. * Should we use additional mount option to enable branch below? */ - if ((fname->dup.fa & FILE_ATTRIBUTE_REPARSE_POINT) && + if (((fname->dup.fa & FILE_ATTRIBUTE_REPARSE_POINT) || + fname->dup.ea_size) && ino != ni->mi.rno) { struct inode *inode = ntfs_iget5(sbi->sb, &e->ref, NULL); if (!IS_ERR_OR_NULL(inode)) { From patchwork Fri Jun 7 12:15:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689780 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC370192B6A; Fri, 7 Jun 2024 12:16:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762576; cv=none; b=NfOSDgjre2dyAuhrh86991Kk7zQ75RBPKpD+cK5ym07odV07WvNdz3fFtFB4kd7RdO/rHOswe6iQX9Q24C+9V3UlFTYfUY8kenbULQsgqFBVJbghyj65vbZ9rWgUl3DE1j+7KYi4X5oZwLWS6WdAktWyzsHrzrCpX6HZ639z/Z0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762576; c=relaxed/simple; bh=bdc7v58U5+YV3a/IoeHMrgpoIua9Z6Fq3QWkfoSP3PU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=szl6aFqyco7UXYujHN4kzBk8nna/q83q3GD4sN/UtDznbCAOufvSFsW+D/Rza+BAg5RVGtgbMX36xNhltR70piFpVdi+ezcaDjl0Ov6CPfI7ZM1t+AcgL/VV+c/AaJ8UM9GVDl26c+ecdGc+2Tz7sCcQqwpZ4wYQs+6qIq0+CmU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=TuFhbLCE; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=u+COEebs; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="TuFhbLCE"; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="u+COEebs" Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 4CF8A2117; Fri, 7 Jun 2024 12:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762098; bh=fGX3LJWvmJiBdb0H+MRYhaCDPeTRkfcYEhh/amy+hjk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=TuFhbLCE8i0x0ddVOmat7uFqkzGS1GP/vhjvUUXb8T0JwTUeqnl5RDYodMtIAxt/y 7+WrIzba4yyidYkLp27aOhJ/y3lYl/MYQMiOESUrkoxXlY8I6MeJDa4jpVCQ6I/+Ay NECtFXXke3LKXmQ6yjz68kjZLDfOf2DJyPKcoYT8= 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 30766195; Fri, 7 Jun 2024 12:16:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762572; bh=fGX3LJWvmJiBdb0H+MRYhaCDPeTRkfcYEhh/amy+hjk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=u+COEebs+OlPEuYDJfV+IZ+YkWEkhYSGN1h6Yh2mLjuGt+xqtS4WR18+DJu2Jmwfd esTFccXsru7pGmrWK5vx9fQjCCI5+kf4jrIldSMVSHzeaUe8wJTmabruz+PWkbrzDu VA3MdBremMERJ9/GeCCTibZFkl0kTWZxOOGn5HCc= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:11 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 07/18] fs/ntfs3: Add missing .dirty_folio in address_space_operations Date: Fri, 7 Jun 2024 15:15:37 +0300 Message-ID: <20240607121548.18818-8-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) After switching from pages to folio [1], it became evident that the initialization of .dirty_folio for page cache operations was missed for compressed files. [1] https://lore.kernel.org/ntfs3/20240422193203.3534108-1-willy@infradead.org Fixes: 82cae269cfa95 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Konstantin Komarov --- fs/ntfs3/inode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 2a3522bbeeb4..d43a87a79ff2 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -2131,5 +2131,6 @@ const struct address_space_operations ntfs_aops = { const struct address_space_operations ntfs_aops_cmpr = { .read_folio = ntfs_read_folio, .readahead = ntfs_readahead, + .dirty_folio = block_dirty_folio, }; // clang-format on From patchwork Fri Jun 7 12:15:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689781 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E87A19308B; Fri, 7 Jun 2024 12:16:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762577; cv=none; b=JFj63ht9wmt98L35DUY/KokyRpJJoADSKVTJZ/oPx5VcXP1dBzQVd67yMSTzH63DFG15UBnwEfyMirtIqpiGMv2s1hkvzZxuL4jZj5/f4qLgcJwlPSSvFQBOwLSVU7wIj0FIXWnWteKjRTr+cce+mbRKL0iBK4YVyNlGn/YAAIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762577; c=relaxed/simple; bh=lv2mztteK+Og30mLyHgcvpRF65hdo9t8lchl0OiTG0s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EUts1vDjs7tsmtXvOeQbj9m/ZhB5X0PmFj5iAPFMZAUoKISp41MqeH8e5MmOY7atO5ZZNGKzZuSJkkreV0biJIgKI+KDzO60o56U8vbvLJiTo518+ackKxfYYER95BGycbYdf1gz6Lo3vxsO/V/kWHHSwjje8uw5ivV4ZU/yy20= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=CIoVlQ5S; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="CIoVlQ5S" 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 594F52119; Fri, 7 Jun 2024 12:08:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762100; bh=ELH+G0Zm1pE88bJbUOfJO5YDVH2GIcvzQWiyltb4lKk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=CIoVlQ5SWv62BE94OkmrDIbLfXCdcbiJI9TEf+/hfPr0wUZcYgpBKUed03WbSe7uY jFeGpdlcLZWIFfW13lmnWkQBPZNlQNm6Jg5ift76cCmcG94WJo/K31hqPw80sAyR3Y 7SBkBiyByXbDFIXlSEyRuWV9fyO4dmYY7ejV6C1M= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:13 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 08/18] fs/ntfs3: Fix attr_insert_range at end of file Date: Fri, 7 Jun 2024 15:15:38 +0300 Message-ID: <20240607121548.18818-9-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) If the offset is equal to or greater than the end of file, an error is returned. For such operations (i.e., inserting a hole at the end of file), ftruncate(2) should be used. Signed-off-by: Konstantin Komarov --- fs/ntfs3/attrib.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index 0d13da5523b1..68d1c61fe3b5 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -2373,8 +2373,13 @@ int attr_insert_range(struct ntfs_inode *ni, u64 vbo, u64 bytes) mask = (sbi->cluster_size << attr_b->nres.c_unit) - 1; } - if (vbo > data_size) { - /* Insert range after the file size is not allowed. */ + if (vbo >= data_size) { + /* + * Insert range after the file size is not allowed. + * If the offset is equal to or greater than the end of + * file, an error is returned. For such operations (i.e., inserting + * a hole at the end of file), ftruncate(2) should be used. + */ return -EINVAL; } From patchwork Fri Jun 7 12:15:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689782 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57AD1194097; Fri, 7 Jun 2024 12:16:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762578; cv=none; b=n+Fh4fARLG/hrQYW2vCJwdxyO8aI+9Cnr1rRNec4dt4iLddlGs1YEQp12mEakdjjAajwuKNs706p+AHCs7jv/qiNYPaCIgFaYGzKh3+Ovrhj33QT5GVkq4WkP1bBhROFl2eKKdQFapbQyW2O2h/ut/7ZtkCflqbv39e05widMa0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762578; c=relaxed/simple; bh=IDXHPwZU8zALb1dVj+JDa36NpI0ML5BFBX3jkG325/Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jnZrmYe1GzV1nCK9VCpfAxAHWnezf9XNi4HY7QW27DcpYFYh0VGmycog/lAsCvNB3TXR4ggAiJEbCH3I29LQi1BT3QpmFkI7VZl2Zvv3apSb/z0UlyN/7hSGhsJvQsJt0/SgW0DYMnRcyDRKpC6faJfaN4Kh/vqOG35JydABnYE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=d0NqXQm8; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=gjneoprT; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="d0NqXQm8"; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="gjneoprT" Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id AB2B82111; Fri, 7 Jun 2024 12:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762101; bh=PLpDTAuPwmuChFu88p0R105H1Nq2kjyzVIh/lCRxU/o=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=d0NqXQm8xE9HOFVsrLG3Get/cSsSj8NgwmTSDU/xfWAZdWUQvVkON2RpV7gm3Oq6X JVhJxVhRAc0xL/rrpWQUioDlo8VXCpXMetDn6Mxh3Tg3Xne3AW54o6xQoqoiSpmJf/ 8Q3MErrOEjbPXcbURZpN7laQZsawHyjDJc21JUO8= 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 8F170195; Fri, 7 Jun 2024 12:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762575; bh=PLpDTAuPwmuChFu88p0R105H1Nq2kjyzVIh/lCRxU/o=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gjneoprT4AtPMhX5ZWsjtz8G53BN+Q83iGi3BygDP76xjPkRZHxhWFzx7lhnGV6b2 OUf6QBh8QupsJ5vJEuDI0etPzGA/JIna0xEtefyJ8UQKzH1jtpJhzhhrnWreXqj6rm lhJ6zftyV5mLv6siZXuRUzCgm/+L30tpvpiFC/uM= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:15 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 09/18] fs/ntfs3: Replace inode_trylock with inode_lock Date: Fri, 7 Jun 2024 15:15:39 +0300 Message-ID: <20240607121548.18818-10-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) The issue was detected due to xfstest 465 failing. Fixes: 4342306f0f0d5i ("fs/ntfs3: Add file operations and implementation") Signed-off-by: Konstantin Komarov --- fs/ntfs3/file.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index 2f903b6ce157..9ae202901f3c 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -299,10 +299,7 @@ static int ntfs_file_mmap(struct file *file, struct vm_area_struct *vma) } if (ni->i_valid < to) { - if (!inode_trylock(inode)) { - err = -EAGAIN; - goto out; - } + inode_lock(inode); err = ntfs_extend_initialized_size(file, ni, ni->i_valid, to); inode_unlock(inode); From patchwork Fri Jun 7 12:15:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689783 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAC00193096; Fri, 7 Jun 2024 12:16:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762580; cv=none; b=t7uSqy59I0UcMMkkINsONGf9erbgNKfjB1UWBb6RS/qAuyaDMynwCB/fWX8lKMI/VCRLyvfPO+QWX0ecF1NiGnvbmnLgUSVT+ZAwWnAPO7syHxOowlPVKPX3I3ekR9L+U8+g0UfSFiBaDrvvHRXUT5lOXqeqAlr89P9FIO3h+TM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762580; c=relaxed/simple; bh=3Gx4jk1cpfnv09caCY1DKsrrDbFLhjDAp6lh7M4ByCQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GX4WZPlJvg/LjRNY+E4cJyaewlHIkehJMLCTJivfmFteS+6iIM5/zMdVHflR2C8SXM28dUfHGApf58gUCQfRHGeNS3sl8pDJ8WQ7wiGhjqz/r5ur/PhADzPdD+SBhlYn59mdpCJ6VCHaKdesi9Ko+WB5vKauSgvrV/pL2KK6Sas= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=q6xixpP0; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="q6xixpP0" 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 EDD012113; Fri, 7 Jun 2024 12:08:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762103; bh=8u+Q76oxJF1clofIfbRfsd1y6ovFf5s500dJZxmChZs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=q6xixpP0SdxNTM4bdbMIfI8YdQwKzY7DaELnEp2Bjt81IaQgemLNsojm5BVDn8Gdq iUxZgfE04IUbfrwMWgHpNOzs0IuMaFXYQlbG5vcGRwkO26Av8XD2CrXuPBbdTLRawg zoMGgwbGadvLrnmAZDFIHILlWn1iSbVVlxUpL6ag= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:16 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 10/18] fs/ntfs3: One more reason to mark inode bad Date: Fri, 7 Jun 2024 15:15:40 +0300 Message-ID: <20240607121548.18818-11-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) In addition to returning an error, mark the node as bad. Signed-off-by: Konstantin Komarov --- fs/ntfs3/frecord.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index 0008670939a4..660a7cfba8f6 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -1601,8 +1601,10 @@ int ni_delete_all(struct ntfs_inode *ni) asize = le32_to_cpu(attr->size); roff = le16_to_cpu(attr->nres.run_off); - if (roff > asize) + if (roff > asize) { + _ntfs_bad_inode(&ni->vfs_inode); return -EINVAL; + } /* run==1 means unpack and deallocate. */ run_unpack_ex(RUN_DEALLOCATE, sbi, ni->mi.rno, svcn, evcn, svcn, From patchwork Fri Jun 7 12:15:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689789 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 303D6194A6F; Fri, 7 Jun 2024 12:16:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762582; cv=none; b=F+SoCXKyE3BlqfbUe+pDqXuTfEC4YMroSattFfAnZiWgc40O0WyikGwfLGY2oBmc4UPa1o1versAiM7RnpgzSwRhZuvu21CjkuRlRTmbtpTIg8vV2sO28qvKvYOTEhS4ZSvAlnZQkUXSsRtOFgKDW+arKna+OYigWkGwCE37aqE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762582; c=relaxed/simple; bh=+sh2942xg7otXAhEOsOddtY/dsAfg9v0H5F5AxFP6OI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VI4StMzVO5YRFolRMI9z1irvNEiN2FMqRIbUtV/pHp3tDCaE0VHiZAwiPQQn3gnEGoC+SQUXx0Z+G9szHevH5bi4KHnAKJg5PhU+Q5HOqRnd1zaxWFhU8GbuxfE4NZFYtoG7rCraenJRmsUnp5ZN0DU9j/C+tuauf2vJL0GkxCA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=A/2JORl3; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=HemVv2k0; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="A/2JORl3"; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="HemVv2k0" Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 5392E2117; Fri, 7 Jun 2024 12:08:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762104; bh=5ovyOW9zK48E2EPge8I/zbgW83PBsM38/HIRGE3qOL0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=A/2JORl39FcVK4OEEMaucj9YsmfrMeAcUgWPUWnUTJ884uvPjqdB2w/on5LVlgP4A 6uda+AcdxRC3YoN2zvRSoM71RIn+bv7iw2gdRWZo9frRNipuFvo8ogxtRpw7Eg265+ 1G5X4PDzt/r35SvKzxTrY34aV+YH+PocTkC1B7Io= 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 3756F195; Fri, 7 Jun 2024 12:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762578; bh=5ovyOW9zK48E2EPge8I/zbgW83PBsM38/HIRGE3qOL0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=HemVv2k0zeMaY109Ljfrfig1KjoWFhUcQW73o6fKzTpoHlR0HRfuBHee8Vdo3a4dU JslCyqtIoAeOfyKG5SOuwBQmRPuIl28TR2HAoWVFM+5nG2sDwGG/nsKKAq1ieDktwu MVlGpKKHTBUCTnmAeKh2S8UmoAtImOhtDJzEh+kk= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:17 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 11/18] fs/ntfs3: Correct undo if ntfs_create_inode failed Date: Fri, 7 Jun 2024 15:15:41 +0300 Message-ID: <20240607121548.18818-12-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Clusters allocated for Extended Attributes, must be freed when rolling back inode creation. Fixes: 82cae269cfa95 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Konstantin Komarov --- fs/ntfs3/inode.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index d43a87a79ff2..c9a2f0ee117e 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1666,7 +1666,9 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, * The packed size of extended attribute is stored in direntry too. * 'fname' here points to inside new_de. */ - ntfs_save_wsl_perm(inode, &fname->dup.ea_size); + err = ntfs_save_wsl_perm(inode, &fname->dup.ea_size); + if (err) + goto out6; /* * update ea_size in file_name attribute too. @@ -1710,6 +1712,12 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, goto out2; out6: + attr = ni_find_attr(ni, NULL, NULL, ATTR_EA, NULL, 0, NULL, NULL); + if (attr && attr->non_res) { + /* Delete ATTR_EA, if non-resident. */ + attr_set_size(ni, ATTR_EA, NULL, 0, NULL, 0, NULL, false, NULL); + } + if (rp_inserted) ntfs_remove_reparse(sbi, IO_REPARSE_TAG_SYMLINK, &new_de->ref); From patchwork Fri Jun 7 12:15:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689790 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A67C6194A75; Fri, 7 Jun 2024 12:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762583; cv=none; b=Nq8ao1jVBy8yALTlh0pzMcXl1VkxPomtKdrDlct9V1NgvPsnaU05HIawQKA/v0QD6qgnaBV+3EvRomlbuX0arQGCd0sSo5c2Ju8ObGJS3fzFFnOdb4SX6NPtfh4FJf+EOScyqHhFN3oR1pQYITIKrDHqjdT6PvjkBlhVL8pPipE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762583; c=relaxed/simple; bh=kH+wsSdgaNX52+l+RYxhfvSSu0fwEe5uQnP97NGPDIs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DwZy3N3hMTpnOn37g+q7H3oeoUkywVOFCjsiyAAgnKuI8hX7a005Jub9EdnPCPpuwyGPXYuVkzmRl6//Hbv+5NIMphGlbPDKDGU9AqDvcJS3huEmS4BjUgCazOShkmnCmsaB0eABorPQRWfYnuVCwPGi9rI32F4Z3qsLgtOBGEc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=lOCRlfbe; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="lOCRlfbe" 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 035942111; Fri, 7 Jun 2024 12:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762106; bh=rZ+FvsoFzB6Ze1li1a6xt3L+qbetk7U6W84312JB2LY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=lOCRlfbe8SKKecox0mm04M6lzDP9XrKOTvottIWpmgvqdPiIKgjXFSA5O3suYHubH rVfryGrXjyJjkUb3qWoNmGFBQIhz9cSH4qOhfaU0Ll2zudT4mNNuetU8jRy77Anm6T 1auh4x8qin3If9Joy6mPN25ZqsChJZhGWjmd8z3A= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:19 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov , lei lu Subject: [PATCH 12/18] fs/ntfs3: Add a check for attr_names and oatbl Date: Fri, 7 Jun 2024 15:15:42 +0300 Message-ID: <20240607121548.18818-13-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Added out-of-bound checking for *ane (ATTR_NAME_ENTRY). Reported-by: lei lu Fixes: 865e7a7700d93 ("fs/ntfs3: Reduce stack usage") Signed-off-by: Konstantin Komarov --- fs/ntfs3/fslog.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index d7807d255dfe..055c2af602c3 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -3722,6 +3722,8 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) u64 rec_lsn, checkpt_lsn = 0, rlsn = 0; struct ATTR_NAME_ENTRY *attr_names = NULL; + u32 attr_names_bytes = 0; + u32 oatbl_bytes = 0; struct RESTART_TABLE *dptbl = NULL; struct RESTART_TABLE *trtbl = NULL; const struct RESTART_TABLE *rt; @@ -3736,6 +3738,7 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) struct NTFS_RESTART *rst = NULL; struct lcb *lcb = NULL; struct OPEN_ATTR_ENRTY *oe; + struct ATTR_NAME_ENTRY *ane; struct TRANSACTION_ENTRY *tr; struct DIR_PAGE_ENTRY *dp; u32 i, bytes_per_attr_entry; @@ -4314,17 +4317,40 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) lcb = NULL; check_attribute_names2: - if (rst->attr_names_len && oatbl) { - struct ATTR_NAME_ENTRY *ane = attr_names; - while (ane->off) { + if (attr_names && oatbl) { + off = 0; + for (;;) { + /* Check we can use attribute name entry 'ane'. */ + static_assert(sizeof(*ane) == 4); + if (off + sizeof(*ane) > attr_names_bytes) { + /* just ignore the rest. */ + break; + } + + ane = Add2Ptr(attr_names, off); + t16 = le16_to_cpu(ane->off); + if (!t16) { + /* this is the only valid exit. */ + break; + } + + /* Check we can use open attribute entry 'oe'. */ + if (t16 + sizeof(*oe) > oatbl_bytes) { + /* just ignore the rest. */ + break; + } + /* TODO: Clear table on exit! */ - oe = Add2Ptr(oatbl, le16_to_cpu(ane->off)); + oe = Add2Ptr(oatbl, t16); t16 = le16_to_cpu(ane->name_bytes); + off += t16 + sizeof(*ane); + if (off > attr_names_bytes) { + /* just ignore the rest. */ + break; + } oe->name_len = t16 / sizeof(short); oe->ptr = ane->name; oe->is_attr_name = 2; - ane = Add2Ptr(ane, - sizeof(struct ATTR_NAME_ENTRY) + t16); } } From patchwork Fri Jun 7 12:15:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689791 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEF3D194AD0; Fri, 7 Jun 2024 12:16:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762585; cv=none; b=u4D2yzVisLvAmu73/7t8jwjikOg57cBAV/wFr9LKcDq7wDybxXTuqWOLFIdQre0/8rj6a8lOQnLN6NTu+IrdXaIuPzL+d159SDgxozzivVVTfTCrrN1CdeVgWQen86oIe+qJDNNsyR0kUxE0hbyWtaOKL2JXgu92OgU9pzCZdiM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762585; c=relaxed/simple; bh=dE3xbrb288BUcy0ffw0XuM+Wo69zpin7XHmKE6h0t/Y=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RLcLLzCFt5IY7MdeAZKlEohnAnT5q3gI+7l1fcZTlvmV2OSBIwyBw8h1CSICFTDR0mDEf6WHjkgly8dKhmRH9UkDRU4oKMUCCxRGegniEzQEkZTabW7QyhfGpx1YJ+csMI6qyO7eKR9VOMES8mgTFUuAK9+VbHY1QH7z54ELpo0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=ql6b1Rc+; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=udhbf3NC; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="ql6b1Rc+"; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="udhbf3NC" Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 238322113; Fri, 7 Jun 2024 12:08:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762107; bh=ym80i2jTMD1HhHw9F6CkuGUlURqOKsq9Wpygi7rED0Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ql6b1Rc+StMi1+r0ITd5QoV2mnkysFlrCipV2oajuuunicN2cf3sdyQuNStnoiT0k ewrtZN55TlktwwSnXYH0/dlr93yU/VENgkFlmorIm2wPgndpvyaWlmmKT7jiMkALLv 6qo9gAC1nJIiyI9YLRs2d7wJnQcahRP3FDYTz5RM= 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 0695A195; Fri, 7 Jun 2024 12:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762581; bh=ym80i2jTMD1HhHw9F6CkuGUlURqOKsq9Wpygi7rED0Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=udhbf3NCsD2gP7uFZbWhAJDK+16Ws0gCfh+H5vIymtSFnBiNhTA/CtNcp7LEsjWiy 5pfNgE7fRDZXHqHcZHjZx/SGVY3GrKlv5RM1VZvZIazH/Y5PRyqNQEzR/JiZeWHr05 hhFIdHuG7VUDcGDtK+LLH3IJRWN3St/8eQtlkWYs= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:20 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 13/18] fs/ntfs3: Use macros NTFS_LABEL_MAX_LENGTH instead of hardcoded value Date: Fri, 7 Jun 2024 15:15:43 +0300 Message-ID: <20240607121548.18818-14-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) To check the length of the volume label, the existing constant NTFS_LABEL_MAX_LENGTH could be used. Signed-off-by: Konstantin Komarov --- fs/ntfs3/fsntfs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c index 626d3f2c7e2d..0fa636038b4e 100644 --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -2650,8 +2650,8 @@ int ntfs_set_label(struct ntfs_sb_info *sbi, u8 *label, int len) { int err; struct ATTRIB *attr; + u32 uni_bytes; struct ntfs_inode *ni = sbi->volume.ni; - const u8 max_ulen = 0x80; /* TODO: use attrdef to get maximum length */ /* Allocate PATH_MAX bytes. */ struct cpu_str *uni = __getname(); @@ -2663,7 +2663,8 @@ int ntfs_set_label(struct ntfs_sb_info *sbi, u8 *label, int len) if (err < 0) goto out; - if (uni->len > max_ulen) { + uni_bytes = uni->len * sizeof(u16); + if (uni_bytes > NTFS_LABEL_MAX_LENGTH * sizeof(u16)) { ntfs_warn(sbi->sb, "new label is too long"); err = -EFBIG; goto out; @@ -2674,13 +2675,13 @@ int ntfs_set_label(struct ntfs_sb_info *sbi, u8 *label, int len) /* Ignore any errors. */ ni_remove_attr(ni, ATTR_LABEL, NULL, 0, false, NULL); - err = ni_insert_resident(ni, uni->len * sizeof(u16), ATTR_LABEL, NULL, - 0, &attr, NULL, NULL); + err = ni_insert_resident(ni, uni_bytes, ATTR_LABEL, NULL, 0, &attr, + NULL, NULL); if (err < 0) goto unlock_out; /* write new label in on-disk struct. */ - memcpy(resident_data(attr), uni->name, uni->len * sizeof(u16)); + memcpy(resident_data(attr), uni->name, uni_bytes); /* update cached value of current label. */ if (len >= ARRAY_SIZE(sbi->volume.label)) From patchwork Fri Jun 7 12:15:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689792 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8C60194C93; Fri, 7 Jun 2024 12:16:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762585; cv=none; b=NxbL0C+tjaULIeD/lbObP+RObq1XAU4t8ZtbwwHcMMUPSaYbh+fQo9nlQ0uDhStPkvbJVlMYCcPTQ286DAqDNatcueqCoCCHwTK39y5T4MK//CvYTn7TmBGvL7lM+temRRf4BaNszhO4YgTS/Tq7vhL9E4Aei4/H9ajbZFhI6/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762585; c=relaxed/simple; bh=FLs3WPnMi4Qn41zvRBy2Q7uyU38hh1awhc2HHjOGV4E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kcmRTfP/9pZHH4ewNtyu5/vEzusWD7brh3cvCFOSKj2R3pZNFlm6wsw/JWsG6eVDwU//f7IZMViRwFUPDrtGU/2/QLzuJj7zvHuKM2HFZ/p7gDof31SDEuLTO2Ok1Qu/+1h0qxdAxeTVczMcDPYl+vTGPaXkOY1w7AVNRW4azm8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=JbhystdN; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="JbhystdN" 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 0FC022119; Fri, 7 Jun 2024 12:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762108; bh=zHsLvz6osWfE3TmkcyKZjWOaqyoi8Qs6E8wNxI8KraE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JbhystdNPitG9/q2a+VVljNiZ2kCAYZQ85iyjKfsrrIicEze/NIjCQMRjuytaIXU1 zi11k3rtaxjM99r89ySgRWTidbow0LTDzwrmSU7UJYzp+pq0b4nrKTGbG0wS+b/WbC DAQS89o7W/TAlEMXxJsfVU8+NjQMBY/CV8+py1B8= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:21 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 14/18] fs/ntfs3: Merge synonym COMPRESSION_UNIT and NTFS_LZNT_CUNIT Date: Fri, 7 Jun 2024 15:15:44 +0300 Message-ID: <20240607121548.18818-15-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) COMPRESSION_UNIT and NTFS_LZNT_CUNIT mean the same thing (1u< --- fs/ntfs3/frecord.c | 2 +- fs/ntfs3/fslog.c | 2 +- fs/ntfs3/inode.c | 2 +- fs/ntfs3/ntfs.h | 3 --- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index 660a7cfba8f6..c7ab8d6f3896 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -1501,7 +1501,7 @@ int ni_insert_nonresident(struct ntfs_inode *ni, enum ATTR_TYPE type, if (is_ext) { if (flags & ATTR_FLAG_COMPRESSED) - attr->nres.c_unit = COMPRESSION_UNIT; + attr->nres.c_unit = NTFS_LZNT_CUNIT; attr->nres.total_size = attr->nres.alloc_size; } diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index 055c2af602c3..6049ba33d384 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -2992,7 +2992,7 @@ static struct ATTRIB *attr_create_nonres_log(struct ntfs_sb_info *sbi, if (is_ext) { attr->name_off = SIZEOF_NONRESIDENT_EX_LE; if (is_attr_compressed(attr)) - attr->nres.c_unit = COMPRESSION_UNIT; + attr->nres.c_unit = NTFS_LZNT_CUNIT; attr->nres.run_off = cpu_to_le16(SIZEOF_NONRESIDENT_EX + name_size); diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index c9a2f0ee117e..f3f6af10a586 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1506,7 +1506,7 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, attr->size = cpu_to_le32(SIZEOF_NONRESIDENT_EX + 8); attr->name_off = SIZEOF_NONRESIDENT_EX_LE; attr->flags = ATTR_FLAG_COMPRESSED; - attr->nres.c_unit = COMPRESSION_UNIT; + attr->nres.c_unit = NTFS_LZNT_CUNIT; asize = SIZEOF_NONRESIDENT_EX + 8; } else { attr->size = cpu_to_le32(SIZEOF_NONRESIDENT + 8); diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h index 3d6143c7abc0..1f2cdb0dbbe1 100644 --- a/fs/ntfs3/ntfs.h +++ b/fs/ntfs3/ntfs.h @@ -82,9 +82,6 @@ typedef u32 CLST; #define RESIDENT_LCN ((CLST)-2) #define COMPRESSED_LCN ((CLST)-3) -#define COMPRESSION_UNIT 4 -#define COMPRESS_MAX_CLUSTER 0x1000 - enum RECORD_NUM { MFT_REC_MFT = 0, MFT_REC_MIRR = 1, From patchwork Fri Jun 7 12:15:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689793 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27588195808; Fri, 7 Jun 2024 12:16:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762586; cv=none; b=PG+SynQUnuJ6+gZwXoXQK0frT/p5UQIatsIa23xqTiOAhVaOAXG5owwIiwS9WKphOW1nKFO1QNy1Zeg4e7PP45xSBx/0yAAqWjYlwTxrvMYKGCt1d1AXYMVzcoaUvnIr0qkA4un/a918GDoG91DUnJEWY/XiBzFnYSnkeHX8s8w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762586; c=relaxed/simple; bh=5kjkfThvuQA69/cISjSLIfgcj+LkJZeORavkgbHvrf4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=L0WtQcFQiC5/H8Su7fAiwEuGdXGSSJmn3awCcBVdTTBlIM/w5lqcajyE5UVmsfUnZNijVpkeacJv6NIXSjy/a8rYF5My7l06cg/fliBL2DpWqJqYUKsmC5ojkM3iu2HloO31LyEMkl0t2e/RIyk8cWDSY/pbtbDwCCc0sRrYcoQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=gIGVhle3; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=i99mM42n; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="gIGVhle3"; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="i99mM42n" Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 7F39F2111; Fri, 7 Jun 2024 12:08:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762109; bh=vVAUSjzFV74Wpp24l92pd4CdaVxe69nKA4VMgiDOHv0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gIGVhle32vQyUOIxlJavOPxkw55gqCD3WVSANt92+1MXooz9Q3ZeCzpE77Hf9bNw7 14byoUlbRLg6sA4ldbzPCehcztG1faO/VGsWTQMVlKh5AzatpWa1huNJVapS7rPDw/ OeDmiNdrf+2XmPMe+KnXJcyq1Cmu9T+zBeOYGI0I= 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 63FF2195; Fri, 7 Jun 2024 12:16:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762583; bh=vVAUSjzFV74Wpp24l92pd4CdaVxe69nKA4VMgiDOHv0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=i99mM42nD/tKucft2XWC/ek4ljynfG1A2cLP7UbllwuqJb7YIYvvQvqPlXFpaz0Ms iqKiK59uUeJjfUCyi0lS+gjHCb6XXdsPhxYzuzElPoCeMe0id7IdGDxrYKDmrW3y9Q v1vt+LWn6KhGmz71Xf5zbfwC3ok2RGeFtO6hz5qo= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:22 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 15/18] fs/ntfs3: Remove sync_blockdev_nowait() Date: Fri, 7 Jun 2024 15:15:45 +0300 Message-ID: <20240607121548.18818-16-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Flush the file mapping directly. Signed-off-by: Konstantin Komarov --- fs/ntfs3/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index f3f6af10a586..46130cbd08d4 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1093,7 +1093,7 @@ int ntfs_flush_inodes(struct super_block *sb, struct inode *i1, if (!ret && i2) ret = writeback_inode(i2); if (!ret) - ret = sync_blockdev_nowait(sb->s_bdev); + ret = filemap_flush(sb->s_bdev_file->f_mapping); return ret; } From patchwork Fri Jun 7 12:15:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689794 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5ACAB196C9C; Fri, 7 Jun 2024 12:16:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762587; cv=none; b=ucJTWZNi2AzS4tN1NBDLlGXMTobIYIgs++QLSjwDwt2LbS2KCvRG6007RaVEHyPB0oN3w1FNVCMGJ/hKnZLC9AiHpHT1kogHueJFerGmljd6aDEkppyYUu7ifoM6AtS9llW0r2rhaus8+vQq5JUW4KEIl1QMo20SBqOKiHO/p7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762587; c=relaxed/simple; bh=JSCX7RvGYGCm4Gt9Lb/auQxZOXkDNo7HEW2q6MDF6cA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JQ4o33zrolHe/p4wfJMAcmDys8wVwYB2B3P/WKghVQswqOF8mMCbBl5hStNaLmhzzkzFUm1xyYx7/va4V1/UGBYdhs0vLV6P1CXiOOhY9neCHd6Ag6xudw7eQx2JQ4+KtvEvayoOEGFlCy+ALn0Td0cuYNSC0xHrr5hRal/GX8s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=aT1r6suv; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="aT1r6suv" 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 A69552117; Fri, 7 Jun 2024 12:08:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762110; bh=ItUueD9NFEUMthklqoi57QXeYkb5LTRd3/OWcQ0+j1c=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=aT1r6suv1YQ7IBfTqgJ85L69Qt3lCPBVsTzu8fLkiHW1XbadA47yNnXND9dEK8ERJ y3pOs4/uH3QF/XgTqwFEV/svo7VavCzyGR8v0O9ZVNpadZZ++5mfw6A+Ej9rNnUEmc v54C80Wxvw2Z/ubiWONTqWBpGPvGHffE43bpALM0= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:24 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 16/18] fs/ntfs3: Remove unused macros MAXIMUM_REPARSE_DATA_BUFFER_SIZE Date: Fri, 7 Jun 2024 15:15:46 +0300 Message-ID: <20240607121548.18818-17-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) MAXIMUM_REPARSE_DATA_BUFFER_SIZE is not used in the code. Signed-off-by: Konstantin Komarov --- fs/ntfs3/ntfs.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h index 1f2cdb0dbbe1..a5ca08db6dc5 100644 --- a/fs/ntfs3/ntfs.h +++ b/fs/ntfs3/ntfs.h @@ -999,9 +999,6 @@ struct REPARSE_POINT { static_assert(sizeof(struct REPARSE_POINT) == 0x18); -/* Maximum allowed size of the reparse data. */ -#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE (16 * 1024) - /* * The value of the following constant needs to satisfy the following * conditions: From patchwork Fri Jun 7 12:15:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689795 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76011197A64; Fri, 7 Jun 2024 12:16:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762588; cv=none; b=gLRQo7zjo8bC/P2JqqJNQOGsScc/7whTbZTsLqopx95/vnV+MMhKOKkAxcFvg1u/BUI7Ec3OBoMDd8+yWCYAdO/LzmbtMDpsMiTRr9tJXL5lz8/qU6mOAPpW+cRZmpgm3VowURyjTOmCG8ZN2Nbb8FTADCHtt1dNSXGEkihWTBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762588; c=relaxed/simple; bh=nUHidUzz1T0S+HSHLdTUekBbn8Zo3THzDfTfWfN6Fxg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LhnuHxhGgDUUV/zN9uk6Le5GSggsMWm+gcEvFGdjJd8AWix+24JM5P3H1nT82D1aNk4hokiGAwQv18duV+PXKsPdtStPYz0qpDekpowitIr2amt80Ir2LNdKuSyaLZulS5+TYjIIquscYsWnR3ffb6YFqf5Zb3fPXnbA0SFlxsY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=QUmZvKhN; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=iExIxDTN; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="QUmZvKhN"; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="iExIxDTN" Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id C71EA2113; Fri, 7 Jun 2024 12:08:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762111; bh=0jJtz0eUYHftgd+JKDAtTz3HVvB1qMm8PesV+dw6f8Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=QUmZvKhNWmQeghV5foiFsHvMMLNZxdC4rrv/gciu5yKSMaRs9UEunl87NjmLUtwz0 xb1NXGbvK8QhVlmmD3B86J0qPNg8ZevJUxZDF180ECHRzJHpMEwSWgyzKReU+A8FiQ y42xXxSUEo/LQs85b592lzrezQVtEAbQe7TdBgfs= 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 A992B195; Fri, 7 Jun 2024 12:16:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762585; bh=0jJtz0eUYHftgd+JKDAtTz3HVvB1qMm8PesV+dw6f8Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=iExIxDTNNCzD5gq6CrHZ52od/rxFwKtPrfC7rcG9j3Ja4yxGlpTMVbsmVFDKT20vh 8unw3dAhlSuXpABY6Ay4p8t1xp/DMxhwtGUjIG7dwZkPSA4vAnAcz6pb2DmWGaRmux mmTLRR4Vv6WAc3T35edJrUp03zzauar8qPtNHsnE= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:25 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 17/18] fs/ntfs3: Rename variables Date: Fri, 7 Jun 2024 15:15:47 +0300 Message-ID: <20240607121548.18818-18-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) New names make it easier to read code. Signed-off-by: Konstantin Komarov --- fs/ntfs3/fslog.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index 6049ba33d384..389fce092d6d 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -4243,9 +4243,9 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) } t32 = lrh_length(lrh); - rec_len -= t32; + attr_names_bytes = rec_len - t32; - attr_names = kmemdup(Add2Ptr(lrh, t32), rec_len, GFP_NOFS); + attr_names = kmemdup(Add2Ptr(lrh, t32), attr_names_bytes, GFP_NOFS); if (!attr_names) { err = -ENOMEM; goto out; @@ -4277,14 +4277,14 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) t16 = le16_to_cpu(lrh->redo_off); rt = Add2Ptr(lrh, t16); - t32 = rec_len - t16; + oatbl_bytes = rec_len - t16; - if (!check_rstbl(rt, t32)) { + if (!check_rstbl(rt, oatbl_bytes)) { err = -EINVAL; goto out; } - oatbl = kmemdup(rt, t32, GFP_NOFS); + oatbl = kmemdup(rt, oatbl_bytes, GFP_NOFS); if (!oatbl) { err = -ENOMEM; goto out; From patchwork Fri Jun 7 12:15:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 13689796 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA07B1990A5; Fri, 7 Jun 2024 12:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762590; cv=none; b=IB/v3bGB6lMNsqdMk2YKUCky7SX8ywHze4JCnlams4BOtElU+7Q8oRKPjSobQ5Vy93L4eTmxsgmuboR4J7nvrdQoDy3wRg5i6eq2PKXUBnqKuW/C44MF9t7/FcWeqfU2EPM+iu0DEHNouiy1NwnqxzYE8E6LRb2XJqpNid2wNA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717762590; c=relaxed/simple; bh=Yacxdvk9agwC7dm+tRdWYE6QBG5sEvZ2POWkQC00ekM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=h7jAzH+08Lbtny1i+3wBVFzSTGIapVyIIAq6YU0quonOYZWubObYvawk6aNi69IrZIoXgROFGb27MAY9fTepQURxPxPCOhPUIOhUhmNHT7fD/+L8e61d6CnUIOmu8TXJKdreOYkhEXL6FEAHqbnbCoydoOE40REAjnrTbKpiDUk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=CqPDluEv; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="CqPDluEv" 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 0C4642111; Fri, 7 Jun 2024 12:08:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762113; bh=6qiKymjDgGJvobrjtMHFM+VNPPdAqGv/F7p+4NzzYnc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=CqPDluEv97gyHQjiNU40B2RXjnBcpIgbqd32An5eDDDzb0PzIbMNNYKdXgQFN9D3b 8c1AJjlIQY+f5xlqJ9ci/ooLnFiy/aJxAIlGag9/DComDOzkQbf7b+UqS2XTJj3+E+ SbYSwrRKT/XrB1iwP9o+xaZNYjxFYRzCzLu/nAOs= Received: from ntfs3vm.paragon-software.com (192.168.211.95) 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; Fri, 7 Jun 2024 15:16:26 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 18/18] fs/ntfs3: Add some comments Date: Fri, 7 Jun 2024 15:15:48 +0300 Message-ID: <20240607121548.18818-19-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Signed-off-by: Konstantin Komarov --- fs/ntfs3/fslog.c | 14 ++++++-------- fs/ntfs3/inode.c | 4 ++-- fs/ntfs3/super.c | 5 ++--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index 389fce092d6d..21c23f6bd7f6 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -4107,7 +4107,7 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) /* Allocate and Read the Transaction Table. */ if (!rst->transact_table_len) - goto check_dirty_page_table; + goto check_dirty_page_table; /* reduce tab pressure. */ t64 = le64_to_cpu(rst->transact_table_lsn); err = read_log_rec_lcb(log, t64, lcb_ctx_prev, &lcb); @@ -4147,7 +4147,7 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) check_dirty_page_table: /* The next record back should be the Dirty Pages Table. */ if (!rst->dirty_pages_len) - goto check_attribute_names; + goto check_attribute_names; /* reduce tab pressure. */ t64 = le64_to_cpu(rst->dirty_pages_table_lsn); err = read_log_rec_lcb(log, t64, lcb_ctx_prev, &lcb); @@ -4183,7 +4183,7 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) /* Convert Ra version '0' into version '1'. */ if (rst->major_ver) - goto end_conv_1; + goto end_conv_1; /* reduce tab pressure. */ dp = NULL; while ((dp = enum_rstbl(dptbl, dp))) { @@ -4203,8 +4203,7 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) * remembering the oldest lsn values. */ if (sbi->cluster_size <= log->page_size) - goto trace_dp_table; - + goto trace_dp_table; /* reduce tab pressure. */ dp = NULL; while ((dp = enum_rstbl(dptbl, dp))) { struct DIR_PAGE_ENTRY *next = dp; @@ -4225,7 +4224,7 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) check_attribute_names: /* The next record should be the Attribute Names. */ if (!rst->attr_names_len) - goto check_attr_table; + goto check_attr_table; /* reduce tab pressure. */ t64 = le64_to_cpu(rst->attr_names_lsn); err = read_log_rec_lcb(log, t64, lcb_ctx_prev, &lcb); @@ -4257,7 +4256,7 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) check_attr_table: /* The next record should be the attribute Table. */ if (!rst->open_attr_len) - goto check_attribute_names2; + goto check_attribute_names2; /* reduce tab pressure. */ t64 = le64_to_cpu(rst->open_attr_table_lsn); err = read_log_rec_lcb(log, t64, lcb_ctx_prev, &lcb); @@ -4546,7 +4545,6 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) } } goto next_log_record_analyze; - ; } case OpenNonresidentAttribute: diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 46130cbd08d4..374b10e5a6b7 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -18,7 +18,7 @@ #include "ntfs_fs.h" /* - * ntfs_read_mft - Read record and parses MFT. + * ntfs_read_mft - Read record and parse MFT. */ static struct inode *ntfs_read_mft(struct inode *inode, const struct cpu_str *name, @@ -1557,7 +1557,7 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, /* * Below function 'ntfs_save_wsl_perm' requires 0x78 bytes. - * It is good idea to keep extened attributes resident. + * It is good idea to keep extended attributes resident. */ if (asize + t16 + 0x78 + 8 > sbi->record_size) { CLST alen; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 6c9e5fe8ce81..e70ba2370c6e 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -1205,7 +1205,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) /* * Load $Volume. This should be done before $LogFile - * 'cause 'sbi->volume.ni' is used 'ntfs_set_state'. + * 'cause 'sbi->volume.ni' is used in 'ntfs_set_state'. */ ref.low = cpu_to_le32(MFT_REC_VOL); ref.seq = cpu_to_le16(MFT_REC_VOL); @@ -1866,8 +1866,7 @@ static int __init init_ntfs_fs(void) ntfs_inode_cachep = kmem_cache_create( "ntfs_inode_cache", sizeof(struct ntfs_inode), 0, - (SLAB_RECLAIM_ACCOUNT | SLAB_ACCOUNT), - init_once); + (SLAB_RECLAIM_ACCOUNT | SLAB_ACCOUNT), init_once); if (!ntfs_inode_cachep) { err = -ENOMEM; goto out1;