Skip to content

Commit

Permalink
fs/ntfs3: Keep preallocated only if option prealloc enabled
Browse files Browse the repository at this point in the history
commit e95113e upstream.

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: 4342306 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
aalexandrovich authored and gregkh committed Jun 9, 2022
1 parent 898bd43 commit a2e7be8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ntfs3/file.c
Expand Up @@ -495,7 +495,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)
Expand Down

0 comments on commit a2e7be8

Please sign in to comment.