|
Kmods SIG |
8b815c |
From 14a981193e409d8ca3f89768cfbd7a9a516d9927 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
8b815c |
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
|
|
Kmods SIG |
8b815c |
Date: Mon, 4 Oct 2021 18:52:24 +0300
|
|
Kmods SIG |
8b815c |
Subject: [Backport 14a981193e40] src: Refactor ntfs_create_inode
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
Set size for symlink, so we don't need to calculate it on the fly.
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
|
|
Kmods SIG |
8b815c |
---
|
|
Kmods SIG |
8b815c |
src/inode.c | 11 ++++++++---
|
|
Kmods SIG |
8b815c |
1 file changed, 8 insertions(+), 3 deletions(-)
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
diff --git a/src/inode.c b/src/inode.c
|
|
Kmods SIG |
8b815c |
index d618b0573533c043acd2fadc59a20e9ce0c772cb..bdebbbd53e766f7435640e55c1551be0fadccd19 100644
|
|
Kmods SIG |
8b815c |
--- a/src/inode.c
|
|
Kmods SIG |
8b815c |
+++ b/src/inode.c
|
|
Kmods SIG |
8b815c |
@@ -1488,7 +1488,10 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,
|
|
Kmods SIG |
8b815c |
asize = ALIGN(SIZEOF_RESIDENT + nsize, 8);
|
|
Kmods SIG |
8b815c |
t16 = PtrOffset(rec, attr);
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
- /* 0x78 - the size of EA + EAINFO to store WSL */
|
|
Kmods SIG |
8b815c |
+ /*
|
|
Kmods SIG |
8b815c |
+ * Below function 'ntfs_save_wsl_perm' requires 0x78 bytes.
|
|
Kmods SIG |
8b815c |
+ * It is good idea to keep extened attributes resident.
|
|
Kmods SIG |
8b815c |
+ */
|
|
Kmods SIG |
8b815c |
if (asize + t16 + 0x78 + 8 > sbi->record_size) {
|
|
Kmods SIG |
8b815c |
CLST alen;
|
|
Kmods SIG |
8b815c |
CLST clst = bytes_to_cluster(sbi, nsize);
|
|
Kmods SIG |
8b815c |
@@ -1523,14 +1526,14 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,
|
|
Kmods SIG |
8b815c |
}
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
asize = SIZEOF_NONRESIDENT + ALIGN(err, 8);
|
|
Kmods SIG |
8b815c |
- inode->i_size = nsize;
|
|
Kmods SIG |
8b815c |
} else {
|
|
Kmods SIG |
8b815c |
attr->res.data_off = SIZEOF_RESIDENT_LE;
|
|
Kmods SIG |
8b815c |
attr->res.data_size = cpu_to_le32(nsize);
|
|
Kmods SIG |
8b815c |
memcpy(Add2Ptr(attr, SIZEOF_RESIDENT), rp, nsize);
|
|
Kmods SIG |
8b815c |
- inode->i_size = nsize;
|
|
Kmods SIG |
8b815c |
nsize = 0;
|
|
Kmods SIG |
8b815c |
}
|
|
Kmods SIG |
8b815c |
+ /* Size of symlink equals the length of input string. */
|
|
Kmods SIG |
8b815c |
+ inode->i_size = size;
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
attr->size = cpu_to_le32(asize);
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
@@ -1567,6 +1570,8 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,
|
|
Kmods SIG |
8b815c |
inode->i_op = &ntfs_link_inode_operations;
|
|
Kmods SIG |
8b815c |
inode->i_fop = NULL;
|
|
Kmods SIG |
8b815c |
inode->i_mapping->a_ops = &ntfs_aops;
|
|
Kmods SIG |
8b815c |
+ inode->i_size = size;
|
|
Kmods SIG |
8b815c |
+ inode_nohighmem(inode);
|
|
Kmods SIG |
8b815c |
} else if (S_ISREG(mode)) {
|
|
Kmods SIG |
8b815c |
inode->i_op = &ntfs_file_inode_operations;
|
|
Kmods SIG |
8b815c |
inode->i_fop = &ntfs_file_operations;
|
|
Kmods SIG |
8b815c |
--
|
|
Kmods SIG |
8b815c |
2.31.1
|
|
Kmods SIG |
8b815c |
|