diff options
| author | Hongling Zeng <zenghongling@kylinos.cn> | 2026-10-21 14:32:21 +0800 |
|---|---|---|
| committer | Namjae Jeon <linkinjeon@kernel.org> | 2026-10-23 09:43:20 +0900 |
| commit | 5dffb7307023d909277cb5f5f3f18f32afa31e2f (patch) | |
| tree | 0f8b698ce4d7bb299e06275d0a3aa9aff9827688 /include/uapi/linux/android | |
| parent | b713b69cf79ef52b1737a1a6c09df2522ff875af (diff) | |
ntfs: handle a failed size rollback in the write error path
ntfs_file_write_iter() extends the data and initialized sizes before
it copies the user data and restores them when the write then fails.
The restoration is best-effort: both results are discarded, even
though the extension is already recorded in the dirty MFT record.
When the restoration fails too, the extended sizes reach the disk
while the VFS inode keeps reporting the old ones: after a remount the
file appears grown again, with an uninitialized tail where the failed
write never put any data, and nothing records the failure.
Keep both undo results: roll the initialized size back first, and
roll the data size back only when that rollback succeeded. The data
rollback goes through the same VFS-facing truncate
ntfs_setattr_size() uses, which also supports compressed attributes,
and keeps the VFS size on the durable data size when it fails. Its
shrink clamps the initialized size to the rolled-back data size,
which can sit above the old initialized size, so a failed initialized
size rollback would leave the clamp in place and expose the
uninitialized tail. The undo runs under the mapping invalidate lock,
like ntfs_setattr_size(), which the truncate expects. On an undo
failure, set NVolSetErrors(), which the next persistence point
persists as VOLUME_IS_DIRTY, and log a message for the errors=
policy.
Fixes: 9c87959601e8 ("ntfs: update file operations")
Suggested-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Diffstat (limited to 'include/uapi/linux/android')
0 files changed, 0 insertions, 0 deletions
