Skip to contentSkip to conversation

inconsistent output on sub list

PATCH New Brendan Hide 2 participants 4 messages Jan 22, 2013 – Jan 25, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Linux watricky 3.6.11-1-ARCH #1 SMP PREEMPT Tue Dec 18 08:57:15 CET 2012 x86_64 GNU/Linux

In working on a snapshot maintenance script I've noticed some odd behaviour. Note the smbshare path. I've put this into its own subvolume as I don't plan on snapshotting it.

In the first command's output, this path is printed correctly, however in the second output it has "4.snap" appended, similar to the names of the snapshots I made 22 hours ago.

If this is a documented issue with a fix then no worries. But if not and anyone wants me to check into any further specifics, please let me know.

Quoted 13 lines

[root@watricky mnt]# btrfs subvolume list / -a
ID 258 gen 4226 top level 384 path media/smbshare
ID 259 gen 4337 top level 384 path home
ID 384 gen 4321 top level 5 path <FS_TREE>/__active
ID 392 gen 4337 top level 384 path var
ID 393 gen 4267 top level 384 path usr
ID 428 gen 4267 top level 5 path <FS_TREE>/__snapshot/__active.20130121-23h44.snap ID 429 gen 3980 top level 5 path <FS_TREE>/__snapshot/__active_home.20130121-23h45.snap ID 430 gen 4043 top level 5 path <FS_TREE>/__snapshot/__active_var.20130121-23h45.snap ID 431 gen 4267 top level 5 path <FS_TREE>/__snapshot/__active_usr.20130121-23h45.snap [root@watricky mnt]# btrfs subvolume list /home -a
ID 258 gen 4226 top level 5 path <FS_TREE>/__active/media/smbshare4.snap ID 259 gen 4337 top level 5 path <FS_TREE>/__active/home

Quoted 8 lines

ID 384 gen 4321 top level 5 path <FS_TREE>/__active
ID 392 gen 4337 top level 5 path <FS_TREE>/__active/var
ID 393 gen 4267 top level 5 path <FS_TREE>/__active/usr
ID 428 gen 4267 top level 5 path <FS_TREE>/__snapshot/__active.20130121-23h44.snap ID 429 gen 3980 top level 5 path <FS_TREE>/__snapshot/__active_home.20130121-23h45.snap ID 430 gen 4043 top level 5 path <FS_TREE>/__snapshot/__active_var.20130121-23h45.snap ID 431 gen 4267 top level 5 path <FS_TREE>/__snapshot/__active_usr.20130121-23h45.snap [root@watricky mnt]#

Note that the only directly mounted share is __active, mounted at /.

Signature · 4 lines
__________
Brendan Hide
http://swiftspirit.co.za/
http://www.webafrica.co.za/?AFF1E97
#1 lore raw

PATCH 1/1 Btrfs-progs: we need to have the string null terminated

Bug:
-------------
btrfs subvolume list / -a
ID 258 gen 4226 top level 384 path media/smbshare
::
btrfs subvolume list /home -a
ID 258 gen 4226 top level 5 path <FS_TREE>/__active/media/smbshare4.snap

In the first command's output, this path is printed correctly, however in the second output it has "4.snap" appended, similar to the names of the snapshots I made 22 hours ago.
------------

---
 btrfs-list.c | 1 +
 1 file changed, 1 insertion(+)
btrfs-list.c +1 -0
index e5f0f96..5acba78 100644
@@ -633,6 +633,7 @@ static int resolve_root(struct root_lookup *rl, struct root_info *ri,
 			len = strlen(full_path);
 			tmp = malloc(len + add_len + 2);
 			memcpy(tmp + add_len + 1, full_path, len);
+			tmp[len + add_len + 1] = '\0';
 			tmp[add_len] = '/';
 			memcpy(tmp, p, add_len);
 			free(full_path);
Signature · 6 lines
1.8.1.227.g44fe835

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-
#2 lore raw
In reply to Brendan Hide

Brendan,

-------

Quoted 2 lines
Quoted 2 lines

[root@watricky mnt]# btrfs subvolume list / -a ID 258 gen 4226 top level 384 path media/smbshare

::

Quoted 2 lines
Quoted 2 lines

[root@watricky mnt]# btrfs subvolume list /home -a ID 258 gen 4226 top level 5 path

<FS_TREE>/__active/media/smbshare4.snap
-------
This is definitely a bug. Thanks for reporting.

I have made some fair-assumptions, and have sent out the patch[1] to fix this bug (ref this email thread). Could you kindly test it and report the result ?

[1]
[PATCH] Btrfs-progs: we need to have the string null terminated

Thanks, Anand

Quoted 46 lines · Brendan Hide

Linux watricky 3.6.11-1-ARCH #1 SMP PREEMPT Tue Dec 18 08:57:15 CET 2012 x86_64 GNU/Linux

In working on a snapshot maintenance script I've noticed some odd behaviour. Note the smbshare path. I've put this into its own subvolume as I don't plan on snapshotting it.

In the first command's output, this path is printed correctly, however in the second output it has "4.snap" appended, similar to the names of the snapshots I made 22 hours ago.

If this is a documented issue with a fix then no worries. But if not and anyone wants me to check into any further specifics, please let me know.

Quoted 7 lines

[root@watricky mnt]# btrfs subvolume list / -a ID 258 gen 4226 top level 384 path media/smbshare ID 259 gen 4337 top level 384 path home
ID 384 gen 4321 top level 5 path <FS_TREE>/__active ID 392 gen 4337 top level 384 path var
ID 393 gen 4267 top level 384 path usr
ID 428 gen 4267 top level 5 path

<FS_TREE>/__snapshot/__active.20130121-23h44.snap

Quoted 1 line

ID 429 gen 3980 top level 5 path

<FS_TREE>/__snapshot/__active_home.20130121-23h45.snap

Quoted 1 line

ID 430 gen 4043 top level 5 path

<FS_TREE>/__snapshot/__active_var.20130121-23h45.snap

Quoted 1 line

ID 431 gen 4267 top level 5 path

<FS_TREE>/__snapshot/__active_usr.20130121-23h45.snap

Quoted 7 lines

[root@watricky mnt]# btrfs subvolume list /home -a
ID 258 gen 4226 top level 5 path <FS_TREE>/__active/media/smbshare4.snap ID 259 gen 4337 top level 5 path <FS_TREE>/__active/home
ID 384 gen 4321 top level 5 path <FS_TREE>/__active
ID 392 gen 4337 top level 5 path <FS_TREE>/__active/var
ID 393 gen 4267 top level 5 path <FS_TREE>/__active/usr
ID 428 gen 4267 top level 5 path

<FS_TREE>/__snapshot/__active.20130121-23h44.snap

Quoted 1 line

ID 429 gen 3980 top level 5 path

<FS_TREE>/__snapshot/__active_home.20130121-23h45.snap

Quoted 1 line

ID 430 gen 4043 top level 5 path

<FS_TREE>/__snapshot/__active_var.20130121-23h45.snap

Quoted 1 line

ID 431 gen 4267 top level 5 path

<FS_TREE>/__snapshot/__active_usr.20130121-23h45.snap

Quoted 1 line

[root@watricky mnt]#

Note that the only directly mounted share is __active, mounted at /.

#3 lore raw

Confirmed the fix is working.

^ TLDR can stop here :)

Recompiled the original Archlinux package from newly-synced ABS but also with your patch. I then tested the newly-compiled btrfs with the patch. I realised after I should have also tested immediately before installing the patched version, so I reinstalled the original unpatched version for the final test to confirm the problem was rectified entirely by the one-line change. The attached log shows the detail.

Quoted 72 lines · Anand Jain

Brendan,

-------

Quoted 2 lines
Quoted 2 lines

[root@watricky mnt]# btrfs subvolume list / -a ID 258 gen 4226 top level 384 path media/smbshare

::

Quoted 2 lines
Quoted 2 lines

[root@watricky mnt]# btrfs subvolume list /home -a ID 258 gen 4226 top level 5 path

<FS_TREE>/__active/media/smbshare4.snap
-------
This is definitely a bug. Thanks for reporting.

I have made some fair-assumptions, and have sent out the patch[1] to fix this bug (ref this email thread). Could you kindly test it and report the result ?

[1]
[PATCH] Btrfs-progs: we need to have the string null terminated

Thanks, Anand

Quoted 47 lines · Brendan Hide

Linux watricky 3.6.11-1-ARCH #1 SMP PREEMPT Tue Dec 18 08:57:15 CET 2012 x86_64 GNU/Linux

In working on a snapshot maintenance script I've noticed some odd behaviour. Note the smbshare path. I've put this into its own subvolume as I don't plan on snapshotting it.

In the first command's output, this path is printed correctly, however in the second output it has "4.snap" appended, similar to the names of the snapshots I made 22 hours ago.

If this is a documented issue with a fix then no worries. But if not and anyone wants me to check into any further specifics, please let me know.

Quoted 7 lines

[root@watricky mnt]# btrfs subvolume list / -a ID 258 gen 4226 top level 384 path media/smbshare ID 259 gen 4337 top level 384 path home
ID 384 gen 4321 top level 5 path <FS_TREE>/__active ID 392 gen 4337 top level 384 path var
ID 393 gen 4267 top level 384 path usr
ID 428 gen 4267 top level 5 path

<FS_TREE>/__snapshot/__active.20130121-23h44.snap

Quoted 1 line

ID 429 gen 3980 top level 5 path

<FS_TREE>/__snapshot/__active_home.20130121-23h45.snap

Quoted 1 line

ID 430 gen 4043 top level 5 path

<FS_TREE>/__snapshot/__active_var.20130121-23h45.snap

Quoted 1 line

ID 431 gen 4267 top level 5 path

<FS_TREE>/__snapshot/__active_usr.20130121-23h45.snap

Quoted 2 lines

[root@watricky mnt]# btrfs subvolume list /home -a ID 258 gen 4226 top level 5 path

<FS_TREE>/__active/media/smbshare4.snap

Quoted 5 lines

ID 259 gen 4337 top level 5 path <FS_TREE>/__active/home ID 384 gen 4321 top level 5 path <FS_TREE>/__active ID 392 gen 4337 top level 5 path <FS_TREE>/__active/var ID 393 gen 4267 top level 5 path <FS_TREE>/__active/usr ID 428 gen 4267 top level 5 path

<FS_TREE>/__snapshot/__active.20130121-23h44.snap

Quoted 1 line

ID 429 gen 3980 top level 5 path

<FS_TREE>/__snapshot/__active_home.20130121-23h45.snap

Quoted 1 line

ID 430 gen 4043 top level 5 path

<FS_TREE>/__snapshot/__active_var.20130121-23h45.snap

Quoted 1 line

ID 431 gen 4267 top level 5 path

<FS_TREE>/__snapshot/__active_usr.20130121-23h45.snap

Quoted 1 line

[root@watricky mnt]#

Note that the only directly mounted share is __active, mounted at /.

Signature · 4 lines
__________
Brendan Hide
http://swiftspirit.co.za/
http://www.webafrica.co.za/?AFF1E97

[ [email protected] : 15:03:10 : ~/build/btrfs-progs ] :) sudo pacman -U btrfs-progs-0.19.20121005-4-x86_64.pkg.tar.xz [sudo] password for brendan:
loading packages...
warning: btrfs-progs-0.19.20121005-4 is up to date -- reinstalling resolving dependencies...
looking for inter-conflicts...

Targets (1): btrfs-progs-0.19.20121005-4

Total Installed Size:   2.43 MiB
Net Upgrade Size:       -0.04 MiB

Proceed with installation? [Y/n]

(1/1) checking package integrity                                                                                 [###################################################################] 100%
(1/1) loading package files                                                                                      [###################################################################] 100%
(1/1) checking for file conflicts                                                                                [###################################################################] 100%
(1/1) checking available disk space                                                                              [###################################################################] 100%
(1/1) upgrading btrfs-progs                                                                                      [###################################################################] 100%

[ [email protected] : 15:03:33 : ~/build/btrfs-progs ]
:) sudo su -
[root@watricky ~]# btrfs subvolume list / -a
ID 258 gen 5034 top level 384 path media/smbshare
ID 259 gen 5161 top level 384 path home
ID 384 gen 5161 top level 5 path <FS_TREE>/__active
ID 392 gen 5161 top level 384 path var
ID 393 gen 5161 top level 384 path usr
ID 428 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active.20130121-23h44.snap ID 429 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active_home.20130121-23h45.snap ID 430 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_var.20130121-23h45.snap ID 431 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_usr.20130121-23h45.snap ID 550 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active_home.20130125-13h38.snap ID 552 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_var.20130125-13h38.snap ID 553 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_usr.20130125-13h38.snap ID 555 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active.20130125-13h39.snap [root@watricky ~]# btrfs subvolume list /home -a
ID 258 gen 5034 top level 5 path <FS_TREE>/__active/media/smbshare
ID 259 gen 5161 top level 5 path <FS_TREE>/__active/home
ID 384 gen 5161 top level 5 path <FS_TREE>/__active
ID 392 gen 5161 top level 5 path <FS_TREE>/__active/var
ID 393 gen 5161 top level 5 path <FS_TREE>/__active/usr
ID 428 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active.20130121-23h44.snap ID 429 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active_home.20130121-23h45.snap ID 430 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_var.20130121-23h45.snap ID 431 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_usr.20130121-23h45.snap ID 550 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active_home.20130125-13h38.snap ID 552 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_var.20130125-13h38.snap ID 553 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_usr.20130125-13h38.snap ID 555 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active.20130125-13h39.snap [root@watricky ~]# pacman -S btrfs-progs
warning: btrfs-progs-0.19.20121005-4 is up to date -- reinstalling resolving dependencies...
looking for inter-conflicts...

Targets (1): btrfs-progs-0.19.20121005-4

Total Installed Size:   2.47 MiB
Net Upgrade Size:       0.04 MiB

Proceed with installation? [Y/n]

(1/1) checking package integrity                                                                                 [###################################################################] 100%
(1/1) loading package files                                                                                      [###################################################################] 100%
(1/1) checking for file conflicts                                                                                [###################################################################] 100%
(1/1) checking available disk space                                                                              [###################################################################] 100%
(1/1) upgrading btrfs-progs                                                                                      [###################################################################] 100%

[root@watricky ~]# btrfs subvolume list / -a
ID 258 gen 5034 top level 384 path media/smbshare
ID 259 gen 5162 top level 384 path home
ID 384 gen 5161 top level 5 path <FS_TREE>/__active
ID 392 gen 5162 top level 384 path var
ID 393 gen 5161 top level 384 path usr
ID 428 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active.20130121-23h44.snap ID 429 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active_home.20130121-23h45.snap ID 430 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_var.20130121-23h45.snap ID 431 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_usr.20130121-23h45.snap ID 550 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active_home.20130125-13h38.snap ID 552 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_var.20130125-13h38.snap ID 553 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_usr.20130125-13h38.snap ID 555 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active.20130125-13h39.snap [root@watricky ~]#
[root@watricky ~]# btrfs subvolume list /home -a
ID 258 gen 5034 top level 5 path <FS_TREE>/__active/media/smbshare4.snap ID 259 gen 5162 top level 5 path <FS_TREE>/__active/home
ID 384 gen 5161 top level 5 path <FS_TREE>/__active
ID 392 gen 5162 top level 5 path <FS_TREE>/__active/var
ID 393 gen 5161 top level 5 path <FS_TREE>/__active/usr
ID 428 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active.20130121-23h44.snap ID 429 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active_home.20130121-23h45.snap ID 430 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_var.20130121-23h45.snap ID 431 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_usr.20130121-23h45.snap ID 550 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active_home.20130125-13h38.snap ID 552 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_var.20130125-13h38.snap ID 553 gen 5034 top level 5 path <FS_TREE>/__snapshot/__active_usr.20130125-13h38.snap ID 555 gen 5043 top level 5 path <FS_TREE>/__snapshot/__active.20130125-13h39.snap