linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Atomic replacement of subvolumes is not possible
@ 2010-06-26 17:25 Daniel Baumann
  2010-06-28  0:44 ` C Anthony Risinger
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Baumann @ 2010-06-26 17:25 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Roger Leigh

Hi,

this is basically a forward from
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D587253

"rename(2) allows for the atomic replacement of files.  Being able to
atomically replace subvolume snapshots would be equally invaluable,
since it would permit lock-free replacement of subvolumes.

  % btrfs subvolume snapshot <src> <dest>

creates dest as a snapshot of src. However, if I want to do the
converse,

  % btrfs subvolume snapshot <dest> <src>

then <dest> is snapshotted as <src>/<dest>, i.e. not replacing the
original subvolume, but going inside the original subvolume.

Use case 1:
  I have a subvolume of data under active use, which I want to
  periodically update.  I'd like to do this by atomically
  replacing its contents.  I can replace the content right now
  by deleting the old subvolume and then snapshotting the new
  on in its place, but it's racy.  It really needs to be
  replaced in a single operation, or else there's a small window
  where there is no data, and I'd need to resort to some external
  locking to protect myself.

Use case 2:
  In schroot, we create btrfs subvolume snapshots to get copy-on-
  write chroots.  This works just fine.  We also provide direct
  access to the "source" subvolume, but since it could be
  snapshotted in an inconsistent state while being updated, we
  want to do the following:

  =B7 snapshot source subvolume
  =B7 update snapshot
  =B7 replace source volume with updated snapshot"

Please keep roger in the cc for any replies, thanks.

Regards,
Daniel

--=20
Address:        Daniel Baumann, Burgunderstrasse 3, CH-4562 Biberist
Email:          daniel.baumann@panthera-systems.net
Internet:       http://people.panthera-systems.net/~daniel-baumann/
--
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] 9+ messages in thread

end of thread, other threads:[~2010-07-03 15:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-26 17:25 Atomic replacement of subvolumes is not possible Daniel Baumann
2010-06-28  0:44 ` C Anthony Risinger
2010-06-30 13:31   ` Chris Mason
2010-06-30 14:26     ` C Anthony Risinger
2010-07-02  1:30       ` Chris Mason
2010-07-02 16:26         ` C Anthony Risinger
2010-07-02 19:38         ` Goffredo Baroncelli
2010-07-03 15:19           ` C Anthony Risinger
2010-07-02 21:39     ` Bug#587253: " Roger Leigh

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