Skip to contentSkip to conversation

Btrfs: release space on error in page_mkwrite

PATCH In review Josef Bacik 2 participants 3 messages Jan 10, 2012 – Jan 12, 2012 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: release space on error in page_mkwrite

If updating the inode gave us an ENOSPC we were just returning in page_mkwrite, which is a problem since we make our reservation right before trying to update the inode, so fix the out label so that we actually free our reservation. Thanks,

---
 fs/btrfs/inode.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/btrfs/inode.c +1 -1
index b0d7777..90a32f1 100644
@@ -6509,8 +6509,8 @@ out_unlock:
 	if (!ret)
 		return VM_FAULT_LOCKED;
 	unlock_page(page);
-	btrfs_delalloc_release_space(inode, PAGE_CACHE_SIZE);
 out:
+	btrfs_delalloc_release_space(inode, PAGE_CACHE_SIZE);
 	return ret;
 }
 
Signature · 1 line
1.7.5.2
Tested-by on v1 1/1
#1 lore raw
Quoted 6 lines · Josef Bacik

If updating the inode gave us an ENOSPC we were just returning in page_mkwrite, which is a problem since we make our reservation right before trying to update the inode, so fix the out label so that we actually free our reservation. Thanks,

reproducer:

while :;do ./check 209;done

and some writeback activity, i used compilation or multithreaed random writes via fio. the warning

WARNING: at fs/btrfs/extent-tree.c:7283 btrfs_free_block_groups+0x25b/0x370

appeared within minutes.

david

#2 lore raw
Quoted 4 lines · David Sterba

On Tue, Jan 10, 2012 at 02:20:18PM -0500, Josef Bacik wrote:

WARNING: at fs/btrfs/extent-tree.c:7283 btrfs_free_block_groups+0x25b/0x370

appeared within minutes.

Sorry, I spoke too soon, the test was running overnight and the warning is there. I'll send you updated logs and traces.

david