diff options
author | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2021-10-25 18:31:28 +0300 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2021-11-24 15:13:26 +0300 |
commit | 3880f2b816a7e4ca889b7e8a42e6c62c5706ed36 (patch) | |
tree | 9de183c6f0ecd74200dc34ea6f2f47429479e2a2 /fs/ntfs3/file.c | |
parent | 9186d472ee780fabf74424756c4c00545166157e (diff) | |
download | linux-3880f2b816a7e4ca889b7e8a42e6c62c5706ed36.tar.xz |
fs/ntfs3: Fix fiemap + fix shrink file size (to remove preallocated space)
Two problems:
1. ntfs3_setattr can't truncate preallocated space;
2. if allocated fragment "cross" valid size, then fragment splits into two parts:
- normal part;
- unwritten part (here we must return FIEMAP_EXTENT_LAST).
Before this commit we returned FIEMAP_EXTENT_LAST for whole fragment.
Fixes xfstest generic/092
Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation")
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/file.c')
-rw-r--r-- | fs/ntfs3/file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index 3ac0482c6880..6242708980d0 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -761,7 +761,7 @@ int ntfs3_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, } inode_dio_wait(inode); - if (attr->ia_size < oldsize) + if (attr->ia_size <= oldsize) err = ntfs_truncate(inode, attr->ia_size); else if (attr->ia_size > oldsize) err = ntfs_extend(inode, attr->ia_size, 0, NULL); |