Skip to contentSkip to conversation

ceph-on-btrfs inline-cow regression fix for 3.4.3

PATCH Alexandre Oliva 3 participants 3 messages Jun 13, 2012 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hi, Greg,

There's a btrfs regression in 3.4 that's causing a lot of grief to ceph-on-btrfs users like myself. This small and nice patch cures it. It's in Linus' master already. I've been running it on top of 3.4.2, and it would be very convenient for me if this could be in 3.4.3.

Although the patch mentions ENOSPC, the fix has nothing to do with disk full conditions; it's more along the lines of not finding enough room for inline data contents and/or failing to split the btree nodes to make room for it. I don't know that anyone knows for sure, but without this patch what we get is a horrible error, that can only be fixed with a reboot. Yeah, not even umount&&mount will make the filesystem writable again. The fix makes us return an error condition in this case, that callers are prepared to deal with.

I know btrfs hasn't had maintenance fixes in stable series, but Chris Mason tells me the only reason is that nobody stepped up to do so. Given my interest, I might as well give it a try ;-)

Thanks,

From 2adcac1a7331d93a17285804819caa96070b231f Mon Sep 17 00:00:00 2001
From: Josef Bacik <[email protected]>
Date: Wed, 23 May 2012 16:10:14 -0400
Subject: [PATCH] Btrfs: fall back to non-inline if we don't have enough space

If cow_file_range_inline fails with ENOSPC we abort the transaction which isn't very nice. This really shouldn't be happening anyways but there's no sense in making it a horrible error when we can easily just go allocate normal data space for this stuff. Thanks,

---
 fs/btrfs/inode.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
fs/btrfs/inode.c +4 -1
index 0298928..92df0a5 100644
@@ -257,10 +257,13 @@ static noinline int cow_file_range_inline(struct btrfs_trans_handle *trans,
 	ret = insert_inline_extent(trans, root, inode, start,
 				   inline_len, compressed_size,
 				   compress_type, compressed_pages);
-	if (ret) {
+	if (ret && ret != -ENOSPC) {
 		btrfs_abort_transaction(trans, root, ret);
 		return ret;
+	} else if (ret == -ENOSPC) {
+		return 1;
 	}
+
 	btrfs_delalloc_release_metadata(inode, end + 1 - start);
 	btrfs_drop_extent_cache(inode, start, aligned_end - 1, 0);
 	return 0;
Signature · 1 line
1.7.7.6
Signature · 5 lines
-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer
#1 lore raw
Quoted 3 lines · Alexandre Oliva

I know btrfs hasn't had maintenance fixes in stable series, but Chris Mason tells me the only reason is that nobody stepped up to do so. Given my interest, I might as well give it a try ;-)

Actually 3.3.3 had a fix for btrfs in it.. :-)

http://lwn.net/Articles/493971/

cheers,
Chris

Signature · 1 line
 Chris Samuel  :  http://www.csamuel.org/  :  Melbourne, VIC
#2 lore raw
In reply to Alexandre Oliva
Quoted 6 lines · Alexandre Oliva

Hi, Greg,

There's a btrfs regression in 3.4 that's causing a lot of grief to ceph-on-btrfs users like myself. This small and nice patch cures it. It's in Linus' master already. I've been running it on top of 3.4.2, and it would be very convenient for me if this could be in 3.4.3.

Ack, this can definitely to go 3.4-stable. Thanks Alexandre.

-chris