Commit 55f5bfd4 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Pull ext4 bugfixes from Ted Ts'o.

Misc ext4 fixes, delayed by Ted moving mail servers and email getting
marked as spam due to bad spf records.

* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  ext4: add WARN_ON to check the length of allocated blocks
  ext4: fix retry handling in ext4_ext_truncate()
  ext4: destroy ext4_es_cachep on module unload
  ext4: make sure group number is bumped after a inode allocation race
parents 64b4aaf0 44fb851d
...@@ -4412,7 +4412,7 @@ void ext4_ext_truncate(handle_t *handle, struct inode *inode) ...@@ -4412,7 +4412,7 @@ void ext4_ext_truncate(handle_t *handle, struct inode *inode)
retry: retry:
err = ext4_es_remove_extent(inode, last_block, err = ext4_es_remove_extent(inode, last_block,
EXT_MAX_BLOCKS - last_block); EXT_MAX_BLOCKS - last_block);
if (err == ENOMEM) { if (err == -ENOMEM) {
cond_resched(); cond_resched();
congestion_wait(BLK_RW_ASYNC, HZ/50); congestion_wait(BLK_RW_ASYNC, HZ/50);
goto retry; goto retry;
......
...@@ -734,11 +734,8 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, ...@@ -734,11 +734,8 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
ino = ext4_find_next_zero_bit((unsigned long *) ino = ext4_find_next_zero_bit((unsigned long *)
inode_bitmap_bh->b_data, inode_bitmap_bh->b_data,
EXT4_INODES_PER_GROUP(sb), ino); EXT4_INODES_PER_GROUP(sb), ino);
if (ino >= EXT4_INODES_PER_GROUP(sb)) { if (ino >= EXT4_INODES_PER_GROUP(sb))
if (++group == ngroups) goto next_group;
group = 0;
continue;
}
if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) { if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) {
ext4_error(sb, "reserved inode found cleared - " ext4_error(sb, "reserved inode found cleared - "
"inode=%lu", ino + 1); "inode=%lu", ino + 1);
...@@ -769,6 +766,9 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, ...@@ -769,6 +766,9 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
goto got; /* we grabbed the inode! */ goto got; /* we grabbed the inode! */
if (ino < EXT4_INODES_PER_GROUP(sb)) if (ino < EXT4_INODES_PER_GROUP(sb))
goto repeat_in_this_group; goto repeat_in_this_group;
next_group:
if (++group == ngroups)
group = 0;
} }
err = -ENOSPC; err = -ENOSPC;
goto out; goto out;
......
...@@ -555,14 +555,13 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, ...@@ -555,14 +555,13 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
int ret; int ret;
unsigned long long status; unsigned long long status;
#ifdef ES_AGGRESSIVE_TEST if (unlikely(retval != map->m_len)) {
if (retval != map->m_len) { ext4_warning(inode->i_sb,
printk("ES len assertion failed for inode: %lu " "ES len assertion failed for inode "
"retval %d != map->m_len %d " "%lu: retval %d != map->m_len %d",
"in %s (lookup)\n", inode->i_ino, retval, inode->i_ino, retval, map->m_len);
map->m_len, __func__); WARN_ON(1);
} }
#endif
status = map->m_flags & EXT4_MAP_UNWRITTEN ? status = map->m_flags & EXT4_MAP_UNWRITTEN ?
EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
...@@ -656,14 +655,13 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, ...@@ -656,14 +655,13 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
int ret; int ret;
unsigned long long status; unsigned long long status;
#ifdef ES_AGGRESSIVE_TEST if (unlikely(retval != map->m_len)) {
if (retval != map->m_len) { ext4_warning(inode->i_sb,
printk("ES len assertion failed for inode: %lu " "ES len assertion failed for inode "
"retval %d != map->m_len %d " "%lu: retval %d != map->m_len %d",
"in %s (allocation)\n", inode->i_ino, retval, inode->i_ino, retval, map->m_len);
map->m_len, __func__); WARN_ON(1);
} }
#endif
/* /*
* If the extent has been zeroed out, we don't need to update * If the extent has been zeroed out, we don't need to update
...@@ -1637,14 +1635,13 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, ...@@ -1637,14 +1635,13 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
int ret; int ret;
unsigned long long status; unsigned long long status;
#ifdef ES_AGGRESSIVE_TEST if (unlikely(retval != map->m_len)) {
if (retval != map->m_len) { ext4_warning(inode->i_sb,
printk("ES len assertion failed for inode: %lu " "ES len assertion failed for inode "
"retval %d != map->m_len %d " "%lu: retval %d != map->m_len %d",
"in %s (lookup)\n", inode->i_ino, retval, inode->i_ino, retval, map->m_len);
map->m_len, __func__); WARN_ON(1);
} }
#endif
status = map->m_flags & EXT4_MAP_UNWRITTEN ? status = map->m_flags & EXT4_MAP_UNWRITTEN ?
EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
......
...@@ -5481,6 +5481,7 @@ static void __exit ext4_exit_fs(void) ...@@ -5481,6 +5481,7 @@ static void __exit ext4_exit_fs(void)
kset_unregister(ext4_kset); kset_unregister(ext4_kset);
ext4_exit_system_zone(); ext4_exit_system_zone();
ext4_exit_pageio(); ext4_exit_pageio();
ext4_exit_es();
} }
MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others"); MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment