From 7056146d974a6fc789c96c784fd769e50d58541c Mon Sep 17 00:00:00 2001 From: Lukas Czerner Date: Sun, 10 Mar 2013 22:46:30 -0400 Subject: [PATCH] --- yaml --- r: 361594 b: refs/heads/master c: 232ec8720d4e45405e37144c67053042c6b886d3 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/ext4/extents.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index aabcf1d89030..7e45d675b83c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bb8b20ed94bc69120e31399c43cb336300dea109 +refs/heads/master: 232ec8720d4e45405e37144c67053042c6b886d3 diff --git a/trunk/fs/ext4/extents.c b/trunk/fs/ext4/extents.c index 69df02ff96aa..bd69e906bd91 100644 --- a/trunk/fs/ext4/extents.c +++ b/trunk/fs/ext4/extents.c @@ -4165,9 +4165,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, } } else { BUG_ON(allocated_clusters < reserved_clusters); - /* We will claim quota for all newly allocated blocks.*/ - ext4_da_update_reserve_space(inode, allocated_clusters, - 1); if (reserved_clusters < allocated_clusters) { struct ext4_inode_info *ei = EXT4_I(inode); int reservation = allocated_clusters - @@ -4218,6 +4215,15 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, ei->i_reserved_data_blocks += reservation; spin_unlock(&ei->i_block_reservation_lock); } + /* + * We will claim quota for all newly allocated blocks. + * We're updating the reserved space *after* the + * correction above so we do not accidentally free + * all the metadata reservation because we might + * actually need it later on. + */ + ext4_da_update_reserve_space(inode, allocated_clusters, + 1); } }