* [PATCH] Btrfs: do not merge logged extents if we've removed them from the tree
@ 2013-01-28 14:52 Josef Bacik
2013-01-28 18:52 ` Zach Brown
2013-01-29 2:31 ` Liu Bo
0 siblings, 2 replies; 5+ messages in thread
From: Josef Bacik @ 2013-01-28 14:52 UTC (permalink / raw)
To: linux-btrfs
You can run into this problem where if somebody is fsyncing and writing out
the existing extents you will have removed the extent map from the em tree,
but it's still valid for the current fsync so we go ahead and write it. The
problem is we unconditionally try to merge it back into the em tree, but if
we've removed it from the em tree that will cause problems. So fix this by
only trying to merge it in if it is still a part of the tree. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
---
fs/btrfs/extent_map.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index ed88f5e..9759911 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -289,7 +289,8 @@ out:
void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em)
{
clear_bit(EXTENT_FLAG_LOGGING, &em->flags);
- try_merge_map(tree, em);
+ if (em->in_tree)
+ try_merge_map(tree, em);
}
/**
--
1.7.7.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Btrfs: do not merge logged extents if we've removed them from the tree
2013-01-28 14:52 [PATCH] Btrfs: do not merge logged extents if we've removed them from the tree Josef Bacik
@ 2013-01-28 18:52 ` Zach Brown
2013-01-28 19:19 ` Josef Bacik
2013-01-29 2:31 ` Liu Bo
1 sibling, 1 reply; 5+ messages in thread
From: Zach Brown @ 2013-01-28 18:52 UTC (permalink / raw)
To: Josef Bacik; +Cc: linux-btrfs
> problem is we unconditionally try to merge it back into the em tree, but if
> we've removed it from the em tree that will cause problems. So fix this by
What problems? If I were staring at the symptoms of this bug how would
I find that this commit fixes it?
- z
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Btrfs: do not merge logged extents if we've removed them from the tree
2013-01-28 18:52 ` Zach Brown
@ 2013-01-28 19:19 ` Josef Bacik
2013-01-28 19:20 ` Zach Brown
0 siblings, 1 reply; 5+ messages in thread
From: Josef Bacik @ 2013-01-28 19:19 UTC (permalink / raw)
To: Zach Brown; +Cc: Josef Bacik, linux-btrfs@vger.kernel.org
On Mon, Jan 28, 2013 at 11:52:26AM -0700, Zach Brown wrote:
> > problem is we unconditionally try to merge it back into the em tree, but if
> > we've removed it from the em tree that will cause problems. So fix this by
>
> What problems? If I were staring at the symptoms of this bug how would
> I find that this commit fixes it?
>
I'll fix the commit message, we just add something to the tree that doesn't have
a ref so it's a basic use after free sort of scenario. Thanks,
Josef
> - z
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Btrfs: do not merge logged extents if we've removed them from the tree
2013-01-28 19:19 ` Josef Bacik
@ 2013-01-28 19:20 ` Zach Brown
0 siblings, 0 replies; 5+ messages in thread
From: Zach Brown @ 2013-01-28 19:20 UTC (permalink / raw)
To: Josef Bacik; +Cc: linux-btrfs@vger.kernel.org
> I'll fix the commit message, we just add something to the tree that doesn't have
> a ref so it's a basic use after free sort of scenario. Thanks,
Thanks, complete commit messages help us old farts keep up.
- z
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Btrfs: do not merge logged extents if we've removed them from the tree
2013-01-28 14:52 [PATCH] Btrfs: do not merge logged extents if we've removed them from the tree Josef Bacik
2013-01-28 18:52 ` Zach Brown
@ 2013-01-29 2:31 ` Liu Bo
1 sibling, 0 replies; 5+ messages in thread
From: Liu Bo @ 2013-01-29 2:31 UTC (permalink / raw)
To: Josef Bacik; +Cc: linux-btrfs
On Mon, Jan 28, 2013 at 09:52:56AM -0500, Josef Bacik wrote:
> You can run into this problem where if somebody is fsyncing and writing out
> the existing extents you will have removed the extent map from the em tree,
> but it's still valid for the current fsync so we go ahead and write it. The
> problem is we unconditionally try to merge it back into the em tree, but if
> we've removed it from the em tree that will cause problems. So fix this by
> only trying to merge it in if it is still a part of the tree. Thanks,
>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
> ---
> fs/btrfs/extent_map.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
> index ed88f5e..9759911 100644
> --- a/fs/btrfs/extent_map.c
> +++ b/fs/btrfs/extent_map.c
> @@ -289,7 +289,8 @@ out:
> void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em)
> {
> clear_bit(EXTENT_FLAG_LOGGING, &em->flags);
> - try_merge_map(tree, em);
> + if (em->in_tree)
> + try_merge_map(tree, em);
> }
>
> /**
> --
> 1.7.7.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-29 2:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-28 14:52 [PATCH] Btrfs: do not merge logged extents if we've removed them from the tree Josef Bacik
2013-01-28 18:52 ` Zach Brown
2013-01-28 19:19 ` Josef Bacik
2013-01-28 19:20 ` Zach Brown
2013-01-29 2:31 ` Liu Bo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.