* Snapshot mysteries (and an oops)
@ 2009-12-11 19:16 Andrew Lutomirski
2009-12-11 19:40 ` Goffredo Baroncelli
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lutomirski @ 2009-12-11 19:16 UTC (permalink / raw)
To: linux-btrfs
Hi all-
I'm a bit mystified by snapshots. I think that there are some bugs in
btrfsctl at least (or maybe its documentation). There's definitely at
least one bug in the kernel.
Here's some commands I just tried (vanilla 2.6.32, btrfs-progs from
git today. "test" is a brand-new empty btrfs filesystem, mounted with
default options). Questions and comments are inline:
[test]# btrfsctl -S subvol1 .
operation complete
Btrfs v0.19-4-gab8fb4c
[test]# touch subvol1/file1
[test]# btrfsctl -s snap1 subvol1
operation complete
Btrfs v0.19-4-gab8fb4c
[test]# ls snap1
file1
OK, so it looks like I can make a snapshot of a subvolume, and
everything works as expected.
[test]# mkdir dir2
[test]# touch dir2/file2
[test]# btrfsctl -s snap2 dir2
operation complete
Btrfs v0.19-4-gab8fb4c
[test]# ls snap2
dir2 snap1 subvol1
[test]# ls snap2/snap1
[test]#
WTF? It looks like btrfsctl just snapshotted the subvolume containing
dir2 instead of snapshotting the directory. I would have expected it
to either snapshot just the directory or, if that's impossible, to
fail.
[test]# rm -rf snap1
rm: cannot remove directory `snap1': Directory not empty
[test]# ls snap1
[test]#
OK, so rmdir can't remove snapshots. (Is there any good reason for that?)
[test]# btrfsctl -D snap1
ioctl:: No such file or directory
[test]# btrfsctl -D snap1 .
operation complete
Btrfs v0.19-4-gab8fb4c
I can't make any sense of that. What's the second parameter to -D
supposed to do?
[test]# btrfsctl -D subvol1 .
operation complete
Btrfs v0.19-4-gab8fb4c
Phew. That worked :)
[test]# rm -rf *
OK, now I'm back to where I started.
[test]# btrfsctl -S subvol2 .
operation complete
Btrfs v0.19-4-gab8fb4c
[test]# touch subvol2/file
[test]# ln subvol2/file file
Segmentation fault
Crap. I guess I wasn't supposed to try that. dmesg attached:
Process ln (pid: 3153, threadinfo ffff880196940000, task ffff8801a4149780)
Stack:
0000000000000000 ffff88017a741e00 ffff88018af585d0 000000000000000e
<0> ffff880196941e28 ffff88018af585d0 ffff88017a741e00 ffff88017a7905d0
<0> ffff88017e4b3680 ffff88017a790688 ffff880196941e78 ffffffff81105988
Call Trace:
[<ffffffff81105988>] vfs_link+0xd5/0x14a
Thanks,
Andy
[<ffffffff811057e9>] ? lookup_hash+0x3b/0x3f
[<ffffffff81107eb1>] sys_linkat+0xc4/0x121
[<ffffffff8106af52>] ? up_read+0xe/0x10
[<ffffffff8141d2a9>] ? do_page_fault+0x269/0x299
[<ffffffff81095e6c>] ? audit_syscall_entry+0x11e/0x14a
[<ffffffff81107f2c>] sys_link+0x1e/0x22
[<ffffffff81011cf2>] system_call_fastpath+0x16/0x1b
Code: ff 85 c0 41 89 c6 ba 01 00 00 00 75 39 49 8b 44 24 20 48 89 da
4c 89 fe 4c 89 e7 49 89 45 e0 e8 8f dc ff ff 85 c0 41 89 c6 74 04 <0f>
0b eb fe 48 8b 45 b8 31 d2 48 89 de 4c 89 e7 48 8b 48 28 e8
RIP [<ffffffffa0bc4305>] btrfs_link+0xcf/0x144 [btrfs]
RSP <ffff880196941dd8>
---[ end trace 95f0a8585b4e506f ]---
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Snapshot mysteries (and an oops)
2009-12-11 19:16 Snapshot mysteries (and an oops) Andrew Lutomirski
@ 2009-12-11 19:40 ` Goffredo Baroncelli
2009-12-12 18:37 ` Andy Lutomirski
0 siblings, 1 reply; 4+ messages in thread
From: Goffredo Baroncelli @ 2009-12-11 19:40 UTC (permalink / raw)
To: linux-btrfs
Hi Andrew
On Friday 11 December 2009, Andrew Lutomirski wrote:
> Hi all-
>
> I'm a bit mystified by snapshots. I think that there are some bugs in
> btrfsctl at least (or maybe its documentation). There's definitely at
> least one bug in the kernel.
>
> Here's some commands I just tried (vanilla 2.6.32, btrfs-progs from
> git today. "test" is a brand-new empty btrfs filesystem, mounted with
> default options). Questions and comments are inline:
>
> [test]# mkdir dir2
> [test]# touch dir2/file2
> [test]# btrfsctl -s snap2 dir2
> operation complete
> Btrfs v0.19-4-gab8fb4c
> [test]# ls snap2
> dir2 snap1 subvol1
> [test]# ls snap2/snap1
> [test]#
>
> WTF? It looks like btrfsctl just snapshotted the subvolume containing
> dir2 instead of snapshotting the directory. I would have expected it
> to either snapshot just the directory or, if that's impossible, to
> fail.
It is possible to snapshot a (sub)volume only. I agree that nor the
documentation nor the UI is very clear about that.
> [test]# rm -rf snap1
> rm: cannot remove directory `snap1': Directory not empty
> [test]# ls snap1
> [test]#
>
> OK, so rmdir can't remove snapshots. (Is there any good reason for that?)
The volume is like a filesystem: you cannot remove a directory where is
mounted a filesystem
> [test]# btrfsctl -D snap1
> ioctl:: No such file or directory
> [test]# btrfsctl -D snap1 .
> operation complete
> Btrfs v0.19-4-gab8fb4c
>
> I can't make any sense of that. What's the second parameter to -D
> supposed to do?
>
> [test]# btrfsctl -D subvol1 .
> operation complete
> Btrfs v0.19-4-gab8fb4c
>
> Phew. That worked :)
Yes the docs may be improved. The syntax is:
btrfsctl -D <snapshotname> <directory>
<snapshotname> snapshot name
<directory> where the snapshot is
> [test]# rm -rf *
>
> OK, now I'm back to where I started.
>
> [test]# btrfsctl -S subvol2 .
> operation complete
> Btrfs v0.19-4-gab8fb4c
> [test]# touch subvol2/file
> [test]# ln subvol2/file file
> Segmentation fault
>
> Crap. I guess I wasn't supposed to try that. dmesg attached:
>
> Process ln (pid: 3153, threadinfo ffff880196940000, task ffff8801a4149780)
> Stack:
> 0000000000000000 ffff88017a741e00 ffff88018af585d0 000000000000000e
> <0> ffff880196941e28 ffff88018af585d0 ffff88017a741e00 ffff88017a7905d0
> <0> ffff88017e4b3680 ffff88017a790688 ffff880196941e78 ffffffff81105988
> Call Trace:
> [<ffffffff81105988>] vfs_link+0xd5/0x14a
>
> Thanks,
> Andy
> [<ffffffff811057e9>] ? lookup_hash+0x3b/0x3f
> [<ffffffff81107eb1>] sys_linkat+0xc4/0x121
> [<ffffffff8106af52>] ? up_read+0xe/0x10
> [<ffffffff8141d2a9>] ? do_page_fault+0x269/0x299
> [<ffffffff81095e6c>] ? audit_syscall_entry+0x11e/0x14a
> [<ffffffff81107f2c>] sys_link+0x1e/0x22
> [<ffffffff81011cf2>] system_call_fastpath+0x16/0x1b
> Code: ff 85 c0 41 89 c6 ba 01 00 00 00 75 39 49 8b 44 24 20 48 89 da
> 4c 89 fe 4c 89 e7 49 89 45 e0 e8 8f dc ff ff 85 c0 41 89 c6 74 04 <0f>
> 0b eb fe 48 8b 45 b8 31 d2 48 89 de 4c 89 e7 48 8b 48 28 e8
> RIP [<ffffffffa0bc4305>] btrfs_link+0xcf/0x144 [btrfs]
> RSP <ffff880196941dd8>
> ---[ end trace 95f0a8585b4e506f ]---
> --
> 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
>
BR
Goffredo
--
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijackATinwind.it>
Key fingerprint = 4769 7E51 5293 D36C 814E C054 BF04 F161 3DC5 0512
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Snapshot mysteries (and an oops)
2009-12-11 19:40 ` Goffredo Baroncelli
@ 2009-12-12 18:37 ` Andy Lutomirski
2009-12-12 19:17 ` Goffredo Baroncelli
0 siblings, 1 reply; 4+ messages in thread
From: Andy Lutomirski @ 2009-12-12 18:37 UTC (permalink / raw)
To: Goffredo Baroncelli; +Cc: linux-btrfs
Goffredo Baroncelli wrote:
> Hi Andrew
>
> On Friday 11 December 2009, Andrew Lutomirski wrote:
>> Hi all-
>>
>> [test]# rm -rf snap1
>> rm: cannot remove directory `snap1': Directory not empty
>> [test]# ls snap1
>> [test]#
>>
>> OK, so rmdir can't remove snapshots. (Is there any good reason for that?)
> The volume is like a filesystem: you cannot remove a directory where is
> mounted a filesystem
>
Currently an unprivileged user can create snapshots but can't remove
them. Of course, allowing rmdir on an empty snapshot wouldn't help, but
at least the admin wouldn't be confused when rm -rf fails.
>
>> [test]# btrfsctl -D snap1
>> ioctl:: No such file or directory
>> [test]# btrfsctl -D snap1 .
>> operation complete
>> Btrfs v0.19-4-gab8fb4c
>>
>> I can't make any sense of that. What's the second parameter to -D
>> supposed to do?
>>
>> [test]# btrfsctl -D subvol1 .
>> operation complete
>> Btrfs v0.19-4-gab8fb4c
>>
>> Phew. That worked :)
>
> Yes the docs may be improved. The syntax is:
>
> btrfsctl -D <snapshotname> <directory>
> <snapshotname> snapshot name
> <directory> where the snapshot is
>
What's the point of the last parameter? Can't either btrfsctl or the
filesystem figure that out on its own?
(Can a subvolume be "mounted" in two places at once? If so, maybe the
second parameter makes a tiny bit of sense.)
--Andy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Snapshot mysteries (and an oops)
2009-12-12 18:37 ` Andy Lutomirski
@ 2009-12-12 19:17 ` Goffredo Baroncelli
0 siblings, 0 replies; 4+ messages in thread
From: Goffredo Baroncelli @ 2009-12-12 19:17 UTC (permalink / raw)
To: Andy Lutomirski; +Cc: linux-btrfs
On Saturday 12 December 2009, Andy Lutomirski wrote:
> Goffredo Baroncelli wrote:
[...]
> >
> > Yes the docs may be improved. The syntax is:
> >
> > btrfsctl -D <snapshotname> <directory>
> > <snapshotname> snapshot name
> > <directory> where the snapshot is
> >
>
> What's the point of the last parameter? Can't either btrfsctl or the
> filesystem figure that out on its own?
Pay attention that you can have different sub-volumes with the same name in
different directories.
It would be better if the directory is extracted from the name..
> (Can a subvolume be "mounted" in two places at once? If so, maybe the
> second parameter makes a tiny bit of sense.)
Yes, a subvolume may be mounted in two places (mount -t btrfs -o
subvol=<subvolumename> ...); but that doesn't matter: if you remove a
subvolume.. you remove iteverywhere.
>
> --Andy
Goffredo
--
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijackATinwind.it>
Key fingerprint = 4769 7E51 5293 D36C 814E C054 BF04 F161 3DC5 0512
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-12-12 19:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-11 19:16 Snapshot mysteries (and an oops) Andrew Lutomirski
2009-12-11 19:40 ` Goffredo Baroncelli
2009-12-12 18:37 ` Andy Lutomirski
2009-12-12 19:17 ` Goffredo Baroncelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox