linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problem with btrfs send/receive
@ 2013-05-23 11:51 Felix Blanke
  2013-05-23 12:22 ` Stefan Behrens
  0 siblings, 1 reply; 3+ messages in thread
From: Felix Blanke @ 2013-05-23 11:51 UTC (permalink / raw)
  To: linux-btrfs

Hi everyone,

I was trying the new send/receive feature today but can't make it work.

These are the commands I was using:

btrfs subvol snap -r /mnt/data1/@downloads/ /mnt/data1/snapshots/testsnap
btrfs send /mnt/data1/snapshots/testsnap | btrfs receive
/mnt/data1/snapshots/testreceive/

This command never finishes. A 'ls /mnt/data1/snapshots/testreceive/ '
never finishes too. After killing the send/receive process one can see
that the target subvolume was created but is empty.


Sending the snapshot to a file and use this for receiving does work.
What am I missing?


Kind regards,
Felix

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

* Re: Problem with btrfs send/receive
  2013-05-23 11:51 Problem with btrfs send/receive Felix Blanke
@ 2013-05-23 12:22 ` Stefan Behrens
  2013-05-23 12:29   ` Felix Blanke
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Behrens @ 2013-05-23 12:22 UTC (permalink / raw)
  To: Felix Blanke; +Cc: linux-btrfs

On Thu, 23 May 2013 13:51:59 +0200, Felix Blanke wrote:
> Hi everyone,
> 
> I was trying the new send/receive feature today but can't make it work.
> 
> These are the commands I was using:
> 
> btrfs subvol snap -r /mnt/data1/@downloads/ /mnt/data1/snapshots/testsnap
> btrfs send /mnt/data1/snapshots/testsnap | btrfs receive
> /mnt/data1/snapshots/testreceive/
> 
> This command never finishes. A 'ls /mnt/data1/snapshots/testreceive/ '
> never finishes too. After killing the send/receive process one can see
> that the target subvolume was created but is empty.
> 
> 
> Sending the snapshot to a file and use this for receiving does work.
> What am I missing?
> 

That's a known design flaw in the btrfs send code.
'btrfs send /subvol | sleep 666'
is an easier way to block the system. But it's interruptable if you
terminate the sleep task in this case.

btrfs send blocks on the pipe while being in the kernel, the call chain
is like this:
btrfs_ioctl_send -> send_subvol -> full_send_tree -> changed_cb ->
send_cmd -> write_buf -> vfs_write -> pipe_write -> pipe_wait

And full_send_tree() has called btrfs_join_transaction() before, thus
the whole file system and afterwards the system is blocked.

You can avoid it if you receive to a different filesystem or if you
redirect the output of btrfs send into a file. In general, the output of
btrfs send must never be blocked or you are lost.


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

* Re: Problem with btrfs send/receive
  2013-05-23 12:22 ` Stefan Behrens
@ 2013-05-23 12:29   ` Felix Blanke
  0 siblings, 0 replies; 3+ messages in thread
From: Felix Blanke @ 2013-05-23 12:29 UTC (permalink / raw)
  To: Stefan Behrens; +Cc: linux-btrfs

Hi,

thanks for pointing it out. You are right: Sending the snapshot to a
different btrfs fixes the problem. Interesting :) It's not what you
would except, but for my purposes it's ok, because in the end I'll
send it to a different btrfs.

Felix

On Thu, May 23, 2013 at 2:22 PM, Stefan Behrens
<sbehrens@giantdisaster.de> wrote:
> On Thu, 23 May 2013 13:51:59 +0200, Felix Blanke wrote:
>> Hi everyone,
>>
>> I was trying the new send/receive feature today but can't make it work.
>>
>> These are the commands I was using:
>>
>> btrfs subvol snap -r /mnt/data1/@downloads/ /mnt/data1/snapshots/testsnap
>> btrfs send /mnt/data1/snapshots/testsnap | btrfs receive
>> /mnt/data1/snapshots/testreceive/
>>
>> This command never finishes. A 'ls /mnt/data1/snapshots/testreceive/ '
>> never finishes too. After killing the send/receive process one can see
>> that the target subvolume was created but is empty.
>>
>>
>> Sending the snapshot to a file and use this for receiving does work.
>> What am I missing?
>>
>
> That's a known design flaw in the btrfs send code.
> 'btrfs send /subvol | sleep 666'
> is an easier way to block the system. But it's interruptable if you
> terminate the sleep task in this case.
>
> btrfs send blocks on the pipe while being in the kernel, the call chain
> is like this:
> btrfs_ioctl_send -> send_subvol -> full_send_tree -> changed_cb ->
> send_cmd -> write_buf -> vfs_write -> pipe_write -> pipe_wait
>
> And full_send_tree() has called btrfs_join_transaction() before, thus
> the whole file system and afterwards the system is blocked.
>
> You can avoid it if you receive to a different filesystem or if you
> redirect the output of btrfs send into a file. In general, the output of
> btrfs send must never be blocked or you are lost.
>

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

end of thread, other threads:[~2013-05-23 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-23 11:51 Problem with btrfs send/receive Felix Blanke
2013-05-23 12:22 ` Stefan Behrens
2013-05-23 12:29   ` Felix Blanke

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).