fs/ntfs3: Do not call file_modified if collapse range failed
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Fri, 28 Jun 2024 15:29:46 +0000 (18:29 +0300)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Tue, 3 Sep 2024 13:58:39 +0000 (16:58 +0300)
Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation")
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/file.c

index ca1ddc46bd8664b88b716ce5a9f84652adddcfb1..cddc51f9a93b2355b207b2a1aa3fd945a52d7a0f 100644 (file)
@@ -484,7 +484,7 @@ static int ntfs_truncate(struct inode *inode, loff_t new_size)
 }
 
 /*
- * ntfs_fallocate
+ * ntfs_fallocate - file_operations::ntfs_fallocate
  *
  * Preallocate space for a file. This implements ntfs's fallocate file
  * operation, which gets called from sys_fallocate system call. User
@@ -619,6 +619,8 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
                ni_lock(ni);
                err = attr_collapse_range(ni, vbo, len);
                ni_unlock(ni);
+               if (err)
+                       goto out;
        } else if (mode & FALLOC_FL_INSERT_RANGE) {
                /* Check new size. */
                err = inode_newsize_ok(inode, new_size);