aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/extents.c
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2010-05-16 22:00:00 -0400
committerTheodore Ts'o <tytso@mit.edu>2010-05-16 22:00:00 -0400
commit12e9b892002d9af057655d35b44db8ee9243b0dc (patch)
treec5831b4bcf98eebdd39158d08dab97c198f5c683 /fs/ext4/extents.c
parent24676da469f50f433baa347845639662c561d1f6 (diff)
ext4: Use bitops to read/modify i_flags in struct ext4_inode_info
At several places we modify EXT4_I(inode)->i_flags without holding i_mutex (ext4_do_update_inode, ...). These modifications are racy and we can lose updates to i_flags. So convert handling of i_flags to use bitops which are atomic. https://bugzilla.kernel.org/show_bug.cgi?id=15792 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r--fs/ext4/extents.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 91c3873970e4..42d8ce91adbd 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3498,7 +3498,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
3498 map->m_flags |= EXT4_MAP_UNINIT; 3498 map->m_flags |= EXT4_MAP_UNINIT;
3499 } 3499 }
3500 3500
3501 if (unlikely(EXT4_I(inode)->i_flags & EXT4_EOFBLOCKS_FL)) { 3501 if (unlikely(ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS))) {
3502 if (unlikely(!eh->eh_entries)) { 3502 if (unlikely(!eh->eh_entries)) {
3503 EXT4_ERROR_INODE(inode, 3503 EXT4_ERROR_INODE(inode,
3504 "eh->eh_entries == 0 ee_block %d", 3504 "eh->eh_entries == 0 ee_block %d",
@@ -3509,7 +3509,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
3509 last_ex = EXT_LAST_EXTENT(eh); 3509 last_ex = EXT_LAST_EXTENT(eh);
3510 if (map->m_lblk + ar.len > le32_to_cpu(last_ex->ee_block) 3510 if (map->m_lblk + ar.len > le32_to_cpu(last_ex->ee_block)
3511 + ext4_ext_get_actual_len(last_ex)) 3511 + ext4_ext_get_actual_len(last_ex))
3512 EXT4_I(inode)->i_flags &= ~EXT4_EOFBLOCKS_FL; 3512 ext4_clear_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
3513 } 3513 }
3514 err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); 3514 err = ext4_ext_insert_extent(handle, inode, path, &newex, flags);
3515 if (err) { 3515 if (err) {
@@ -3650,7 +3650,7 @@ static void ext4_falloc_update_inode(struct inode *inode,
3650 * can proceed even if the new size is the same as i_size. 3650 * can proceed even if the new size is the same as i_size.
3651 */ 3651 */
3652 if (new_size > i_size_read(inode)) 3652 if (new_size > i_size_read(inode))
3653 EXT4_I(inode)->i_flags |= EXT4_EOFBLOCKS_FL; 3653 ext4_set_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
3654 } 3654 }
3655 3655
3656} 3656}
@@ -3677,7 +3677,7 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len)
3677 * currently supporting (pre)allocate mode for extent-based 3677 * currently supporting (pre)allocate mode for extent-based
3678 * files _only_ 3678 * files _only_
3679 */ 3679 */
3680 if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)) 3680 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
3681 return -EOPNOTSUPP; 3681 return -EOPNOTSUPP;
3682 3682
3683 /* preallocation to directories is currently not supported */ 3683 /* preallocation to directories is currently not supported */
@@ -3922,7 +3922,7 @@ int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
3922 int error = 0; 3922 int error = 0;
3923 3923
3924 /* fallback to generic here if not in extents fmt */ 3924 /* fallback to generic here if not in extents fmt */
3925 if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)) 3925 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
3926 return generic_block_fiemap(inode, fieinfo, start, len, 3926 return generic_block_fiemap(inode, fieinfo, start, len,
3927 ext4_get_block); 3927 ext4_get_block);
3928 3928