diff options
author | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2022-05-13 19:21:54 +0300 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2022-08-03 18:25:05 +0300 |
commit | b3e048720dee5641c522015d3f0ff0f0dc9cdc37 (patch) | |
tree | d2414fd6e233c84c93b741670f6459c2417be5b0 /fs/ntfs3 | |
parent | c1e0ab3789215a3dfbe95f226955e93ea4803391 (diff) | |
download | linux-b3e048720dee5641c522015d3f0ff0f0dc9cdc37.tar.gz linux-b3e048720dee5641c522015d3f0ff0f0dc9cdc37.tar.bz2 linux-b3e048720dee5641c522015d3f0ff0f0dc9cdc37.zip |
fs/ntfs3: Make ntfs_fallocate return -ENOSPC instead of -EFBIG
In some cases we need to return ENOSPC
Fixes xfstest generic/213
Fixes: 114346978cf6 ("fs/ntfs3: Check new size for limits")
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3')
-rw-r--r-- | fs/ntfs3/file.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index cf16bde810cc..b5f8837f4145 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -671,6 +671,19 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len) ni_unlock(ni); } else { /* Check new size. */ + + /* generic/213: expected -ENOSPC instead of -EFBIG. */ + if (!is_supported_holes) { + loff_t to_alloc = new_size - inode_get_bytes(inode); + + if (to_alloc > 0 && + (to_alloc >> sbi->cluster_bits) > + wnd_zeroes(&sbi->used.bitmap)) { + err = -ENOSPC; + goto out; + } + } + err = inode_newsize_ok(inode, new_size); if (err) goto out; |