Skip to contentSkip to conversation

Make existing snapshots read-only?

DISCUSSION Bruce Guenter 5 participants 5 messages May 28, 2012 – May 29, 2012 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Is there any way to mark existing snapshots as read-only? Making new ones read-only is easy enough, but what about existing ones?

Thanks.

Signature · 1 line
Bruce Guenter <[email protected]>                http://untroubled.org/
#1 lore raw
Quoted 4 lines · Bruce Guenter

Is there any way to mark existing snapshots as read-only? Making new ones read-only is easy enough, but what about existing ones?

We have code in the kernel side, so what we need to do is to update btrfs-progs, which is trivial.

#2 lore raw
Quoted 5 lines · Li Zefan
Quoted 2 lines

Is there any way to mark existing snapshots as read-only? Making new ones read-only is easy enough, but what about existing ones?

We have code in the kernel side, so what we need to do is to update btrfs-progs, which is trivial.

Well, I don't like that it's even possible to turn a RO snapshot to a RW one. What was the rationale behind this back then? Besides, I think that it could break assumptions in the backref code.

If it's only a one-way operation from a regular subvol -> RO subvol, this sounds reasonable to me. If the opposite direction is allowed, then I'd not call it 'read-only' but "unwritable on-request".

david

#3 lore raw
Quoted 7 lines · David Sterba
Quoted 5 lines · Li Zefan
Quoted 2 lines

Is there any way to mark existing snapshots as read-only? Making new ones read-only is easy enough, but what about existing ones?

We have code in the kernel side, so what we need to do is to update btrfs-progs, which is trivial.

Quoted 7 lines

Well, I don't like that it's even possible to turn a RO snapshot to a RW one. What was the rationale behind this back then? Besides, I think that it could break assumptions in the backref code.

If it's only a one-way operation from a regular subvol -> RO subvol, this sounds reasonable to me. If the opposite direction is allowed, then I'd not call it 'read-only' but "unwritable on-request".

Is anyone actually expecting readonly-snapshots to be a worm implementation? And are they sane to expect it?

So long as the permissions required to change it are sane (admin rights to change an arbitrary snapshot, possibly something like write-permission on the mountpoint to change otherwise), I don't see the gain. It's not like root can't modify the disk directly, so withholding an easy way to flip the readonly bit just strikes me as a nuisance feature.

#4 lore raw
In reply to Bruce Guenter
2012-05-28 12:37:00 -0600, Bruce Guenter:
Quoted 3 lines

Is there any way to mark existing snapshots as read-only? Making new ones read-only is easy enough, but what about existing ones?

[...]

you can always do

btrfs sub snap -r vol vol-ro
btrfs sub del vol
mv vol-ro vol

Signature · 1 line
Stephane