diff options
author | 2022-06-09 16:38:15 -0700 | |
---|---|---|
committer | 2022-06-09 16:38:15 -0700 | |
commit | a98a62e456e25048e8d64ec452a1c713169d3517 (patch) | |
tree | 52bc4063aae5015ef28f174d9de409788ee9e0a4 /fs/ntfs3/file.c | |
parent | net: macb: change return type for gem_ptp_set_one_step_sync() (diff) | |
parent | Merge tag 'net-5.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net (diff) | |
download | linux-dev-a98a62e456e25048e8d64ec452a1c713169d3517.tar.xz linux-dev-a98a62e456e25048e8d64ec452a1c713169d3517.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
No conflicts.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'fs/ntfs3/file.c')
-rw-r--r-- | fs/ntfs3/file.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index a4fcdc7927ca..8e9d2b35175f 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -492,7 +492,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) @@ -659,7 +659,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. */ - 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) goto out; @@ -759,7 +765,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); |