diff options
author | Xin Yin <yinxin.x@bytedance.com> | 2021-12-21 03:28:39 +0100 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2022-01-10 19:25:44 +0100 |
commit | 5e4d0eba1ccaf19f93222abdeda5a368be141785 (patch) | |
tree | 540e5c5dbdf551d1dece0a8e2ac6d3893866817d /fs/ext4/inode.c | |
parent | ext4: update fast commit TODOs (diff) | |
download | linux-5e4d0eba1ccaf19f93222abdeda5a368be141785.tar.xz linux-5e4d0eba1ccaf19f93222abdeda5a368be141785.zip |
ext4: fix fast commit may miss tracking range for FALLOC_FL_ZERO_RANGE
when call falloc with FALLOC_FL_ZERO_RANGE, to set an range to unwritten,
which has been already initialized. If the range is align to blocksize,
fast commit will not track range for this change.
Also track range for unwritten range in ext4_map_blocks().
Signed-off-by: Xin Yin <yinxin.x@bytedance.com>
Reviewed-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Link: https://lore.kernel.org/r/20211221022839.374606-1-yinxin.x@bytedance.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Diffstat (limited to '')
-rw-r--r-- | fs/ext4/inode.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 82f555d26980..4895909de21b 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -741,10 +741,11 @@ out_sem: if (ret) return ret; } - ext4_fc_track_range(handle, inode, map->m_lblk, - map->m_lblk + map->m_len - 1); } - + if (retval > 0 && (map->m_flags & EXT4_MAP_UNWRITTEN || + map->m_flags & EXT4_MAP_MAPPED)) + ext4_fc_track_range(handle, inode, map->m_lblk, + map->m_lblk + map->m_len - 1); if (retval < 0) ext_debug(inode, "failed with err %d\n", retval); return retval; |