linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Btrfs: do not use extent commit root for sending
@ 2014-01-14 16:26 Wang Shilong
  2014-01-14 16:26 ` [PATCH] Btrfs: fix wrong search path initialization before searching tree root Wang Shilong
  2014-01-28 14:37 ` [PATCH v2] Btrfs: do not use extent commit root for sending Josef Bacik
  0 siblings, 2 replies; 4+ messages in thread
From: Wang Shilong @ 2014-01-14 16:26 UTC (permalink / raw)
  To: linux-btrfs

From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>

Now we have kicked off transaction from btrfs send, it is not safe
that we use extent commit root to search.

I happended to catch this problem when running sending and snapshot
in my desktop.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
---
Changelog v1->v2:
	extent_from_logical() also search extent tree, we should also
	take care of that part.
---
 fs/btrfs/send.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 591063d..54665d4 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1142,7 +1142,7 @@ static int find_extent_clone(struct send_ctx *sctx,
 	int compressed;
 	u32 i;
 
-	tmp_path = alloc_path_for_send();
+	tmp_path = btrfs_alloc_path();
 	if (!tmp_path)
 		return -ENOMEM;
 
@@ -1225,7 +1225,7 @@ static int find_extent_clone(struct send_ctx *sctx,
 
 	extent_item_pos = logical - found_key.objectid;
 	ret = iterate_extent_inodes(sctx->send_root->fs_info,
-					found_key.objectid, extent_item_pos, 1,
+					found_key.objectid, extent_item_pos, 0,
 					__iterate_backrefs, backref_ctx);
 
 	if (ret < 0)
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] Btrfs: fix wrong search path initialization before searching tree root
  2014-01-14 16:26 [PATCH v2] Btrfs: do not use extent commit root for sending Wang Shilong
@ 2014-01-14 16:26 ` Wang Shilong
  2014-01-28 14:37 ` [PATCH v2] Btrfs: do not use extent commit root for sending Josef Bacik
  1 sibling, 0 replies; 4+ messages in thread
From: Wang Shilong @ 2014-01-14 16:26 UTC (permalink / raw)
  To: linux-btrfs

From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>

To search tree root without transaction protection, we should neither search commit
root nor skip locking here, fix it.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
---
 fs/btrfs/send.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 54665d4..14f9693 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -2095,7 +2095,7 @@ static int send_subvol_begin(struct send_ctx *sctx)
 	char *name = NULL;
 	int namelen;
 
-	path = alloc_path_for_send();
+	path = btrfs_alloc_path();
 	if (!path)
 		return -ENOMEM;
 
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Btrfs: do not use extent commit root for sending
  2014-01-14 16:26 [PATCH v2] Btrfs: do not use extent commit root for sending Wang Shilong
  2014-01-14 16:26 ` [PATCH] Btrfs: fix wrong search path initialization before searching tree root Wang Shilong
@ 2014-01-28 14:37 ` Josef Bacik
  2014-01-28 15:04   ` Wang Shilong
  1 sibling, 1 reply; 4+ messages in thread
From: Josef Bacik @ 2014-01-28 14:37 UTC (permalink / raw)
  To: Wang Shilong, linux-btrfs


On 01/14/2014 11:26 AM, Wang Shilong wrote:
> From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
>
> Now we have kicked off transaction from btrfs send, it is not safe
> that we use extent commit root to search.
>
> I happended to catch this problem when running sending and snapshot
> in my desktop.

I'm confused about this, we are searching a read only snapshot, why 
isn't looking at the commit root ok?  Thanks,

Josef

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Btrfs: do not use extent commit root for sending
  2014-01-28 14:37 ` [PATCH v2] Btrfs: do not use extent commit root for sending Josef Bacik
@ 2014-01-28 15:04   ` Wang Shilong
  0 siblings, 0 replies; 4+ messages in thread
From: Wang Shilong @ 2014-01-28 15:04 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs

Hello Josef,

> 
> On 01/14/2014 11:26 AM, Wang Shilong wrote:
>> From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
>> 
>> Now we have kicked off transaction from btrfs send, it is not safe
>> that we use extent commit root to search.
>> 
>> I happended to catch this problem when running sending and snapshot
>> in my desktop.
> 
> I'm confused about this, we are searching a read only snapshot, why isn't looking at the commit root ok?  Thanks,

I sent a patch to remove transaction outsize before.

http://git.kernel.org/cgit/linux/kernel/git/mason/linux-btrfs.git/commit/?h=integration&id=e0cbfccf3d518f1fb6f8e10932a67d75df2a4380

Previously, we can search extent commit root, it is because we are protected by join and end transaction, since this patch, we can not.

A further  question is now we still have to join transaction actually, only the transaction protection range is smaller,  but we may encounter
extent root's lock contention. I don't know which approach is better, the url's patch have been pushed into chris's integration branch before
i realized it would caused other problems.

Maybe a better a approach is to join and end transaction outsize of find_extent_clone(), and then we still can use extent commit
root for sending.^_^

Thanks,
Wang
> 
> Josef


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-28 15:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-14 16:26 [PATCH v2] Btrfs: do not use extent commit root for sending Wang Shilong
2014-01-14 16:26 ` [PATCH] Btrfs: fix wrong search path initialization before searching tree root Wang Shilong
2014-01-28 14:37 ` [PATCH v2] Btrfs: do not use extent commit root for sending Josef Bacik
2014-01-28 15:04   ` Wang Shilong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).