diff options
author | Zheng Liu <wenqing.lz@taobao.com> | 2013-03-10 21:08:52 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-03-10 21:08:52 -0400 |
commit | cdee78433c138c2f2018a6884673739af2634787 (patch) | |
tree | 91ac86ddb480e0df9385917999645a8c0d35c68b /fs/ext4/extents.c | |
parent | 921f266bc6bfe6ebb599c559f10443af314c19ec (diff) | |
download | op-kernel-dev-cdee78433c138c2f2018a6884673739af2634787.zip op-kernel-dev-cdee78433c138c2f2018a6884673739af2634787.tar.gz |
ext4: fix wrong m_len value after unwritten extent conversion
The ext4_ext_handle_uninitialized_extents() function was assuming the
return value of ext4_ext_map_blocks() is equal to map->m_len. This
incorrect assumption was harmless until we started use status tree as
a extent cache because we need to update status tree according to
'm_len' value.
Meanwhile this commit marks EXT4_MAP_MAPPED flag after unwritten extent
conversion. It shouldn't cause a bug because we update status tree
according to checking EXT4_MAP_UNWRITTEN flag. But it should be fixed.
After applied this commit, the following error message from self-testing
infrastructure disappears.
...
kernel: ES len assertation failed for inode: 230 retval 1 !=
map->m_len 3 in ext4_map_blocks (allocation)
...
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Dmitry Monakhov <dmonakhov@openvz.org>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r-- | fs/ext4/extents.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 25c86aa..110e85a 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -3650,6 +3650,10 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, path, map->m_len); } else err = ret; + map->m_flags |= EXT4_MAP_MAPPED; + if (allocated > map->m_len) + allocated = map->m_len; + map->m_len = allocated; goto out2; } /* buffered IO case */ |