fs/ntfs3: Check new size for limits
We must check size before trying to allocate.
Size can be set for example by "ulimit -f".
Fixes xfstest generic/228
Fixes: 4342306f0f
("fs/ntfs3: Add file operations and implementation")
Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
3880f2b816
commit
114346978c
1 changed files with 7 additions and 1 deletions
|
@ -661,7 +661,13 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
|
||||||
/*
|
/*
|
||||||
* Normal file: Allocate clusters, do not change 'valid' size.
|
* Normal file: Allocate clusters, do not change 'valid' size.
|
||||||
*/
|
*/
|
||||||
err = ntfs_set_size(inode, max(end, i_size));
|
loff_t new_size = max(end, i_size);
|
||||||
|
|
||||||
|
err = inode_newsize_ok(inode, new_size);
|
||||||
|
if (err)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
err = ntfs_set_size(inode, new_size);
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue