summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2021-10-22 16:37:52 +0200
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2021-11-23 16:55:49 +0100
commite95113ed4d428219e3395044e29f5713fc446720 (patch)
tree9af8993f8ab72f094db2c5e8b52dfb7df9af825c
parentfs/ntfs3: Fix some memory leaks in an error handling path of 'log_replay()' (diff)
downloadlinux-e95113ed4d428219e3395044e29f5713fc446720.tar.xz
linux-e95113ed4d428219e3395044e29f5713fc446720.zip
fs/ntfs3: Keep preallocated only if option prealloc enabled
If size of file was reduced, we still kept allocated blocks. This commit makes ntfs3 work as other fs like btrfs. Link: https://bugzilla.kernel.org/show_bug.cgi?id=214719 Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation") Reported-by: Ganapathi Kamath <hgkamath@hotmail.com> Tested-by: Ganapathi Kamath <hgkamath@hotmail.com> Reviewed-by: Kari Argillander <kari.argillander@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
-rw-r--r--fs/ntfs3/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 43b1451bff53..3ac0482c6880 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -494,7 +494,7 @@ static int ntfs_truncate(struct inode *inode, loff_t new_size)
down_write(&ni->file.run_lock);
err = attr_set_size(ni, ATTR_DATA, NULL, 0, &ni->file.run, new_size,
- &new_valid, true, NULL);
+ &new_valid, ni->mi.sbi->options->prealloc, NULL);
up_write(&ni->file.run_lock);
if (new_valid < ni->i_valid)