[PATCH 6/8] btrfs-progs: sub show: Allow non-privileged user to call "subvolume show"

2018-11-26 Thread Misono Tomohiro
Allow non-privileged user to call subvolume show if new ioctls
(BTRFS_IOC_GET_SUBVOL_INFO/BTRFS_IOC_GET_SUBVOL_ROOTREF,
BTRFS_IOC_INO_LOOKUP_USER, from kernel 4.18) are available.
Non-privileged user still cannot use -r or -u option.

The behavior for root user is the same as before.

There are some output differences between root and user:
  root ... subvolume path is from top-level subvolume
   list all snapshots in the fs (inc. non-accessible ones)
  user ... subvolume path is absolute path
   list snapshots under the mountpoint
   (only to which the user has appropriate access right)

[Example]
 $ sudo mkfs.btrfs -f $DEV
 $ sudo mount $DEV /mnt

 $ sudo btrfs subvolume create /mnt/AAA
 $ sudo btrfs subvolume snapshot /mnt/AAA /mnt/snap1
 $ sudo btrfs subvolume snapshot /mnt/AAA /mnt/AAA/snap2

 $ sudo umount /mnt
 $ sudo mount -o subvol=AAA $DEV /mnt

 # root
 $ sudo btrfs subvolume show /mnt
 AAA
  Name:AAA
  UUID:15e80697-2ffb-0b4b-8e1e-e0873a7cf944
  ...
  Snapshot(s):
   AAA/snap2
   snap1

 # non-privileged user
 $ btrfs subvolume show /mnt
 /mnt
  Name:AAA
  UUID:15e80697-2ffb-0b4b-8e1e-e0873a7cf944
  ...
  Snapshot(s):
   /mnt/snap2

Signed-off-by: Misono Tomohiro 
Signed-off-by: David Sterba 
---
 Documentation/btrfs-subvolume.asciidoc |  11 ++-
 cmds-subvolume.c   | 107 ++---
 2 files changed, 105 insertions(+), 13 deletions(-)

diff --git a/Documentation/btrfs-subvolume.asciidoc 
b/Documentation/btrfs-subvolume.asciidoc
index 428a2faa..ea8e9554 100644
--- a/Documentation/btrfs-subvolume.asciidoc
+++ b/Documentation/btrfs-subvolume.asciidoc
@@ -182,12 +182,19 @@ The id can be obtained from *btrfs subvolume list*, 
*btrfs subvolume show* or
 *show* [options] |::
 Show information of a given subvolume in the .
 +
+This command had required root privileges. From kernel 4.18,
+non-privileged user can call this unless -r/-u option is not used.
+Note that for root, output path is relative to the top-level subvolume
+while absolute path is shown for non-privileged user.
+Also for root, snapshots filed lists all the snapshots in the fs while
+only snapshots under mount point are shown for non-privileged user.
++
 `Options`
 +
 -r|--rootid
-rootid of the subvolume.
+rootid of the subvolume (require root privileges).
 -u|--uuid:::
-UUID of the subvolume.
+UUID of the subvolume (require root privileges).
 
 +
 If no option is specified, subvolume information of  is shown,
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index cd2e4425..ab1f14a2 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -1886,8 +1886,12 @@ static int cmd_subvol_find_new(int argc, char **argv)
 static const char * const cmd_subvol_show_usage[] = {
"btrfs subvolume show [options] |",
"Show more information about the subvolume",
-   "-r|--rootid   rootid of the subvolume",
-   "-u|--uuid uuid of the subvolume",
+   "",
+   "This command had required root privileges. From kernel 4.18,",
+   "non-privileged user can call this unless -r/-u option is not used.",
+   "",
+   "-r|--rootid   rootid of the subvolume (require root privileges)",
+   "-u|--uuid uuid of the subvolume   (require root privileges)",
"",
"If no option is specified,  will be shown, otherwise",
"the rootid or uuid are resolved relative to the  path.",
@@ -1900,8 +1904,10 @@ static int cmd_subvol_show(int argc, char **argv)
char uuidparse[BTRFS_UUID_UNPARSED_SIZE];
char *fullpath = NULL;
int fd = -1;
+   int fd_mnt = -1;
int ret = 1;
DIR *dirstream1 = NULL;
+   DIR *dirstream_mnt = NULL;
int by_rootid = 0;
int by_uuid = 0;
u64 rootid_arg = 0;
@@ -1909,7 +1915,10 @@ static int cmd_subvol_show(int argc, char **argv)
struct btrfs_util_subvolume_iterator *iter;
struct btrfs_util_subvolume_info subvol;
char *subvol_path = NULL;
+   char *subvol_name = NULL;
+   char *mount_point = NULL;
enum btrfs_util_error err;
+   bool root;
 
optind = 0;
while (1) {
@@ -1947,6 +1956,12 @@ static int cmd_subvol_show(int argc, char **argv)
usage(cmd_subvol_show_usage);
}
 
+   root = is_root();
+   if (!root && (by_rootid || by_uuid)) {
+   error("only root can use -r or -u options");
+   return -1;
+   }
+
fullpath = realpath(argv[optind], NULL);
if (!fullpath) {
error("cannot find real path for '%s': %m", argv[optind]);
@@ -2001,19 +2016,53 @@ static int cmd_subvol_show(int argc, char **argv)
goto out;
   

[PATCH v2 17/20] btrfs-progs: sub show: Allow non-privileged user to call "subvolume show"

2018-06-18 Thread Misono Tomohiro
Allow non-privileged user to call subvolume show if new ioctls
(BTRFS_IOC_GET_SUBVOL_INFO/BTRFS_IOC_GET_SUBVOL_ROOTREF,
BTRFS_IOC_INO_LOOKUP_USER, from kernel 4.18) are available.
Non-privileged user still cannot use -r or -u option.

The behavior for root user is the same as before.

There are some output differences between root and user:
  root ... subvolume path is from top-level subvolume
   list all snapshots in the fs (inc. non-accessible ones)
  user ... subvolume path is absolute path
   list snapshots under the mountpoint
   (only to which the user has appropriate access right)

[Example]
 $ sudo mkfs.btrfs -f $DEV
 $ sudo mount $DEV /mnt

 $ sudo btrfs subvolume create /mnt/AAA
 $ sudo btrfs subvolume snapshot /mnt/AAA /mnt/snap1
 $ sudo btrfs subvolume snapshot /mnt/AAA /mnt/AAA/snap2

 $ sudo umount /mnt
 $ sudo mount -o subvol=AAA $DEV /mnt

 # root
 $ sudo btrfs subvolume show /mnt
 AAA
  Name:AAA
  UUID:15e80697-2ffb-0b4b-8e1e-e0873a7cf944
  ...
  Snapshot(s):
   AAA/snap2
   snap1

 # non-privileged user
 $ btrfs subvolume show /mnt
 /mnt
  Name:AAA
  UUID:15e80697-2ffb-0b4b-8e1e-e0873a7cf944
  ...
  Snapshot(s):
   /mnt/snap2

Signed-off-by: Misono Tomohiro 
---
 Documentation/btrfs-subvolume.asciidoc |  11 +++-
 cmds-subvolume.c   | 107 +
 2 files changed, 105 insertions(+), 13 deletions(-)

diff --git a/Documentation/btrfs-subvolume.asciidoc 
b/Documentation/btrfs-subvolume.asciidoc
index 2db1d479..fc57e6bc 100644
--- a/Documentation/btrfs-subvolume.asciidoc
+++ b/Documentation/btrfs-subvolume.asciidoc
@@ -194,12 +194,19 @@ The id can be obtained from *btrfs subvolume list*, 
*btrfs subvolume show* or
 *show* [options] |::
 Show information of a given subvolume in the .
 +
+This command had required root privileges. From kernel 4.18,
+non-privileged user can call this unless -r/-u option is not used.
+Note that for root, output path is relative to the top-level subvolume
+while absolute path is shown for non-privileged user.
+Also for root, snapshots filed lists all the snapshots in the fs while
+only snapshots under mount point are shown for non-privileged user.
++
 `Options`
 +
 -r|--rootid
-rootid of the subvolume.
+rootid of the subvolume (require root privileges).
 -u|--uuid:::
-UUID of the subvolume.
+UUID of the subvolume (require root privileges).
 
 +
 If no option is specified, subvolume information of  is shown,
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index ef39789a..4df418b0 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -2095,8 +2095,12 @@ static int cmd_subvol_find_new(int argc, char **argv)
 static const char * const cmd_subvol_show_usage[] = {
"btrfs subvolume show [options] |",
"Show more information about the subvolume",
-   "-r|--rootid   rootid of the subvolume",
-   "-u|--uuid uuid of the subvolume",
+   "",
+   "This command had required root privileges. From kernel 4.18,",
+   "non-privileged user can call this unless -r/-u option is not used.",
+   "",
+   "-r|--rootid   rootid of the subvolume (require root privileges)",
+   "-u|--uuid uuid of the subvolume   (require root privileges)",
"",
"If no option is specified,  will be shown, otherwise",
"the rootid or uuid are resolved relative to the  path.",
@@ -2109,8 +2113,10 @@ static int cmd_subvol_show(int argc, char **argv)
char uuidparse[BTRFS_UUID_UNPARSED_SIZE];
char *fullpath = NULL;
int fd = -1;
+   int fd_mnt = -1;
int ret = 1;
DIR *dirstream1 = NULL;
+   DIR *dirstream_mnt = NULL;
int by_rootid = 0;
int by_uuid = 0;
u64 rootid_arg = 0;
@@ -2118,7 +2124,10 @@ static int cmd_subvol_show(int argc, char **argv)
struct btrfs_util_subvolume_iterator *iter;
struct btrfs_util_subvolume_info subvol;
char *subvol_path = NULL;
+   char *subvol_name = NULL;
+   char *mount_point = NULL;
enum btrfs_util_error err;
+   bool root;
 
while (1) {
int c;
@@ -2155,6 +2164,12 @@ static int cmd_subvol_show(int argc, char **argv)
usage(cmd_subvol_show_usage);
}
 
+   root = is_root();
+   if (!root && (by_rootid || by_uuid)) {
+   error("only root can use -r or -u options");
+   return -1;
+   }
+
fullpath = realpath(argv[optind], NULL);
if (!fullpath) {
error("cannot find real path for '%s': %m", argv[optind]);
@@ -2209,19 +2224,53 @@ static int cmd_subvol_show(int argc, char **argv)
goto out;
}
 
-   er

[PATCH 09/11] btrfs-progs: sub show: Allow non-privileged user to call "subvolume show"

2018-05-11 Thread Tomohiro Misono
Allow non-privileged user to call subvolume show (-r or -u cannot be used)
if new ioctls (BTRFS_IOC_GET_SUBVOL_INFO etc.) are available.
The behavior for root user is the same as before.

There are some output differences between root and user:
  root ... subvolume path is from top-level subvolume
   list all snapshots in the fs (inc. non-accessible ones)
  user ... subvolume path is from mount point
   list snapshots under the mountpoint
   (to which the user has appropriate privileges)

Signed-off-by: Tomohiro Misono <misono.tomoh...@jp.fujitsu.com>
---
 cmds-subvolume.c | 90 
 1 file changed, 78 insertions(+), 12 deletions(-)

diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index c3952172..d88d5d76 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -1883,8 +1883,8 @@ static int cmd_subvol_find_new(int argc, char **argv)
 static const char * const cmd_subvol_show_usage[] = {
"btrfs subvolume show [options] |",
"Show more information about the subvolume",
-   "-r|--rootid   rootid of the subvolume",
-   "-u|--uuid uuid of the subvolume",
+   "-r|--rootid   rootid of the subvolume (require root privileges)",
+   "-u|--uuid uuid of the subvolume   (require root privileges)",
"",
"If no option is specified,  will be shown, otherwise",
"the rootid or uuid are resolved relative to the  path.",
@@ -1897,8 +1897,10 @@ static int cmd_subvol_show(int argc, char **argv)
char uuidparse[BTRFS_UUID_UNPARSED_SIZE];
char *fullpath = NULL;
int fd = -1;
+   int fd_mnt = -1;
int ret = 1;
DIR *dirstream1 = NULL;
+   DIR *dirstream_mnt = NULL;
int by_rootid = 0;
int by_uuid = 0;
u64 rootid_arg = 0;
@@ -1906,6 +1908,8 @@ static int cmd_subvol_show(int argc, char **argv)
struct btrfs_util_subvolume_iterator *iter;
struct btrfs_util_subvolume_info subvol;
char *subvol_path = NULL;
+   char *subvol_name = NULL;
+   char *mount_point = NULL;
enum btrfs_util_error err;
 
while (1) {
@@ -1943,6 +1947,11 @@ static int cmd_subvol_show(int argc, char **argv)
usage(cmd_subvol_show_usage);
}
 
+   if (!is_root() && (by_rootid || by_uuid)) {
+   error("Only root can use -r or -u options");
+   return -1;
+   }
+
fullpath = realpath(argv[optind], NULL);
if (!fullpath) {
error("cannot find real path for '%s': %m", argv[optind]);
@@ -1997,19 +2006,65 @@ static int cmd_subvol_show(int argc, char **argv)
goto out;
}
 
-   err = btrfs_util_subvolume_path_fd(fd, subvol.id, _path);
-   if (err) {
-   error_btrfs_util(err);
-   goto out;
+   if (is_root()) {
+   /* Construct path from top-level subvolume */
+   err = btrfs_util_subvolume_path_fd(fd, subvol.id,
+   _path);
+   if (err) {
+   error_btrfs_util(err);
+   goto out;
+   }
+   subvol_name = strdup(basename(subvol_path));
+   } else {
+   /* Construct path from mount point */
+   ret = find_mount_root(fullpath, _point);
+   if (ret < 0) {
+   error("cannot get mount point");
+   goto out;
+   }
+
+   fd_mnt = open_file_or_dir(mount_point, _mnt);
+   if (fd_mnt < 0) {
+   error("cannot open mount point");
+   goto out;
+   }
+
+   if (strlen(fullpath) == strlen(mount_point)) {
+   /* Get real name at mount point */
+   struct btrfs_ioctl_get_subvol_info_args arg;
+
+   ret = ioctl(fd_mnt, BTRFS_IOC_GET_SUBVOL_INFO,
+   );
+   if (ret < 0) {
+   error("cannot get subvolume info");
+   goto out;
+   }
+   subvol_path = strdup("./");
+   subvol_name = strdup(arg.name);
+   } else {
+   subvol_path = malloc(strlen(fullpath) -
+   strlen(mount_point) 

Re: possible bug - wrong path in 'btrfs subvolume show' when snapshot is in path below subvolume.

2016-08-06 Thread Andrei Borzenkov
05.08.2016 02:32, Peter Holm пишет:
> 'btrfs subvolumee show' gives no path to btrfs system root (volid=5)
> when snapshot is in the folder of subvolume.
> 
> Step to reproduce.
> 1.btrfs subvolume create xyz
> 2.btrfs subvolume snapshot xyz xyz/xyz
> 3.btrfs subvolume snapshot /xyz

This last command is wrong - snapshot name is missing. If you mean

btrfs subvolume snapshot  xyz

- I get "File exists" (assuming that all previous commands were with
 as current directory. This is on openSUSE
Tumbleweed with kernel 4.6.4-2 and btrfsprogs 4.6.1-1.

If my assumption is wrong, please copy and paste exact commands used to
reproduce it.

> 4.btrfs subvolumme show xyz
> output
> .
> Snapshot(s)
>  xyz
>  xyz
> .
> picture from my console reproducing this. Whatchout for my personal fs-layout
> my mountpoint for volid=5 is - as seen in the findmount command  r at
> top of the photo /mnt/btrfs/sdc16-svid-5
> https://s31.postimg.org/9f0d7xb7f/is_this_a_bug.png
> 
> If that can add anything, same thing happends when rootvolume is
> mounted by path. (for the moment it is mounted by volid).
> /Peter Holm
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: possible bug - wrong path in 'btrfs subvolume show' when snapshot is in path below subvolume.

2016-08-06 Thread Peter Holm
You are right. Typing error. Sorry.
Here is from my bash_history.

1 btrfs su create is-this-a-bug
*2 btrfs su snap is-this-a-bug is-this-a-bug
*3 btrfs su snap is-this-a-bug /mnt/btrfs/sdc16-svid-5/

*2.When snapshot is created with the same name as subvolume, then it
by default creates in the subdirectory of the subvolume.
*3. Mountpoint for he root (subvolid=5) volume

Also I in the first post had  a link to an photo from my terminal when
executing thoose commands.
https://s31.postimg.org/9f0d7xb7f/is_this_a_bug.png

/Peter Holm


2016-08-06 7:14 GMT+02:00, Andrei Borzenkov :
> 05.08.2016 02:32, Peter Holm пишет:
>> 'btrfs subvolumee show' gives no path to btrfs system root (volid=5)
>> when snapshot is in the folder of subvolume.
>>
>> Step to reproduce.
>> 1.btrfs subvolume create xyz
>> 2.btrfs subvolume snapshot xyz xyz/xyz
>> 3.btrfs subvolume snapshot /xyz
>
> This last command is wrong - snapshot name is missing. If you mean
>
> btrfs subvolume snapshot  xyz
>
> - I get "File exists" (assuming that all previous commands were with
>  as current directory. This is on openSUSE
> Tumbleweed with kernel 4.6.4-2 and btrfsprogs 4.6.1-1.
>
> If my assumption is wrong, please copy and paste exact commands used to
> reproduce it.
>
>> 4.btrfs subvolumme show xyz
>> output
>> .
>> Snapshot(s)
>>  xyz
>>  xyz
>> .
>> picture from my console reproducing this. Whatchout for my personal
>> fs-layout
>> my mountpoint for volid=5 is - as seen in the findmount command  r at
>> top of the photo /mnt/btrfs/sdc16-svid-5
>> https://s31.postimg.org/9f0d7xb7f/is_this_a_bug.png
>>
>> If that can add anything, same thing happends when rootvolume is
>> mounted by path. (for the moment it is mounted by volid).
>> /Peter Holm
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: possible bug - wrong path in 'btrfs subvolume show' when snapshot is in path below subvolume.

2016-08-06 Thread Peter Holm
I accidentally posted this to Andrei Borzenkov
I repost to the list with the first 3 lines added from what was earlier sent.

Regarding to my manual for btrfs-subvolume  dated 01/19/2016  it says.
"If only  is given, the subvolume will be named the basename of
. "
So 'btrfs su snap  is a shortcut for 'btrfs su snap 
/

Ok. If you try to replace line 2 with
btrfs su snap is-this-a-bug is-this-a-bug/is-this-a-bug
then do the rest of the lines.
After that - what is the lines for Source(s) when you execute  'btrfs
sub  show is-this-a-bug' .?


2016-08-06 11:15 GMT+02:00, Andrei Borzenkov :
> 06.08.2016 11:00, Peter Holm пишет:
>> You are right. Typing error. Sorry.
>> Here is from my bash_history.
>>
>> 1 btrfs su create is-this-a-bug
>> *2 btrfs su snap is-this-a-bug is-this-a-bug
>> *3 btrfs su snap is-this-a-bug /mnt/btrfs/sdc16-svid-5/
>>
>
> As I said, in my case it fails with "File exists"
>
>> *2.When snapshot is created with the same name as subvolume, then it
>> by default creates in the subdirectory of the subvolume.
>> *3. Mountpoint for he root (subvolid=5) volume
>>
>> Also I in the first post had  a link to an photo from my terminal when
>> executing thoose commands.
>> https://s31.postimg.org/9f0d7xb7f/is_this_a_bug.png
>>
>> /Peter Holm
>>
>>
>> 2016-08-06 7:14 GMT+02:00, Andrei Borzenkov :
>>> 05.08.2016 02:32, Peter Holm пишет:
 'btrfs subvolumee show' gives no path to btrfs system root (volid=5)
 when snapshot is in the folder of subvolume.

 Step to reproduce.
 1.btrfs subvolume create xyz
 2.btrfs subvolume snapshot xyz xyz/xyz
 3.btrfs subvolume snapshot /xyz
>>>
>>> This last command is wrong - snapshot name is missing. If you mean
>>>
>>> btrfs subvolume snapshot  xyz
>>>
>>> - I get "File exists" (assuming that all previous commands were with
>>>  as current directory. This is on openSUSE
>>> Tumbleweed with kernel 4.6.4-2 and btrfsprogs 4.6.1-1.
>>>
>>> If my assumption is wrong, please copy and paste exact commands used to
>>> reproduce it.
>>>
 4.btrfs subvolumme show xyz
 output
 .
 Snapshot(s)
  xyz
  xyz
 .
 picture from my console reproducing this. Whatchout for my personal
 fs-layout
 my mountpoint for volid=5 is - as seen in the findmount command  r at
 top of the photo /mnt/btrfs/sdc16-svid-5
 https://s31.postimg.org/9f0d7xb7f/is_this_a_bug.png

 If that can add anything, same thing happends when rootvolume is
 mounted by path. (for the moment it is mounted by volid).
 /Peter Holm
 --
 To unsubscribe from this list: send the line "unsubscribe linux-btrfs"
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

>>>
>>>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: possible bug - wrong path in 'btrfs subvolume show' when snapshot is in path below subvolume.

2016-08-06 Thread Andrei Borzenkov
06.08.2016 11:00, Peter Holm пишет:
> You are right. Typing error. Sorry.
> Here is from my bash_history.
> 
> 1 btrfs su create is-this-a-bug
> *2 btrfs su snap is-this-a-bug is-this-a-bug
> *3 btrfs su snap is-this-a-bug /mnt/btrfs/sdc16-svid-5/
> 

As I said, in my case it fails with "File exists"

> *2.When snapshot is created with the same name as subvolume, then it
> by default creates in the subdirectory of the subvolume.
> *3. Mountpoint for he root (subvolid=5) volume
> 
> Also I in the first post had  a link to an photo from my terminal when
> executing thoose commands.
> https://s31.postimg.org/9f0d7xb7f/is_this_a_bug.png
> 
> /Peter Holm
> 
> 
> 2016-08-06 7:14 GMT+02:00, Andrei Borzenkov :
>> 05.08.2016 02:32, Peter Holm пишет:
>>> 'btrfs subvolumee show' gives no path to btrfs system root (volid=5)
>>> when snapshot is in the folder of subvolume.
>>>
>>> Step to reproduce.
>>> 1.btrfs subvolume create xyz
>>> 2.btrfs subvolume snapshot xyz xyz/xyz
>>> 3.btrfs subvolume snapshot /xyz
>>
>> This last command is wrong - snapshot name is missing. If you mean
>>
>> btrfs subvolume snapshot  xyz
>>
>> - I get "File exists" (assuming that all previous commands were with
>>  as current directory. This is on openSUSE
>> Tumbleweed with kernel 4.6.4-2 and btrfsprogs 4.6.1-1.
>>
>> If my assumption is wrong, please copy and paste exact commands used to
>> reproduce it.
>>
>>> 4.btrfs subvolumme show xyz
>>> output
>>> .
>>> Snapshot(s)
>>>  xyz
>>>  xyz
>>> .
>>> picture from my console reproducing this. Whatchout for my personal
>>> fs-layout
>>> my mountpoint for volid=5 is - as seen in the findmount command  r at
>>> top of the photo /mnt/btrfs/sdc16-svid-5
>>> https://s31.postimg.org/9f0d7xb7f/is_this_a_bug.png
>>>
>>> If that can add anything, same thing happends when rootvolume is
>>> mounted by path. (for the moment it is mounted by volid).
>>> /Peter Holm
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>>> the body of a message to majord...@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>>
>>

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: possible bug - wrong path in 'btrfs subvolume show' when snapshot is in path below subvolume.

2016-08-04 Thread Peter Holm
writing error.
replace "gives no path to" with "same path as"

/Peter Holm

2016-08-05 1:32 GMT+02:00, Peter Holm :
> 'btrfs subvolumee show' gives no path to btrfs system root (volid=5)
> when snapshot is in the folder of subvolume.
>
> Step to reproduce.
> 1.btrfs subvolume create xyz
> 2.btrfs subvolume snapshot xyz xyz/xyz
> 3.btrfs subvolume snapshot /xyz
> 4.btrfs subvolumme show xyz
> output
> .
> Snapshot(s)
>  xyz
>  xyz
> .
> picture from my console reproducing this. Whatchout for my personal
> fs-layout
> my mountpoint for volid=5 is - as seen in the findmount command  r at
> top of the photo /mnt/btrfs/sdc16-svid-5
> https://s31.postimg.org/9f0d7xb7f/is_this_a_bug.png
>
> If that can add anything, same thing happends when rootvolume is
> mounted by path. (for the moment it is mounted by volid).
> /Peter Holm
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


possible bug - wrong path in 'btrfs subvolume show' when snapshot is in path below subvolume.

2016-08-04 Thread Peter Holm
'btrfs subvolumee show' gives no path to btrfs system root (volid=5)
when snapshot is in the folder of subvolume.

Step to reproduce.
1.btrfs subvolume create xyz
2.btrfs subvolume snapshot xyz xyz/xyz
3.btrfs subvolume snapshot /xyz
4.btrfs subvolumme show xyz
output
.
Snapshot(s)
 xyz
 xyz
.
picture from my console reproducing this. Whatchout for my personal fs-layout
my mountpoint for volid=5 is - as seen in the findmount command  r at
top of the photo /mnt/btrfs/sdc16-svid-5
https://s31.postimg.org/9f0d7xb7f/is_this_a_bug.png

If that can add anything, same thing happends when rootvolume is
mounted by path. (for the moment it is mounted by volid).
/Peter Holm
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: subvolume show

2012-12-17 Thread Anand Jain



This looks like a useful capability. I was trying to find out
what the UUID was for a newly created subvolume and have not
found out how to do that.


 btrfs subvol list -u /mnt

 should help ?

 btrfs subvol show subvol is quite useful indeed we should
 consider to have it in git.

-Anand


On 13/12/2012 02:22, Gene Czarcinski wrote:

I was looking through some of the archives and notice a patch submitted
to implement:
btrfs subvolume show path-to-subvolume
command.

I also noticed that is does not appear to be in the git.

This looks like a useful capability. I was trying to find out what the
UUID was for a newly created subvolume and have not found out how to do
that.

Gene
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


subvolume show

2012-12-12 Thread Gene Czarcinski
I was looking through some of the archives and notice a patch submitted 
to implement:

  btrfs  subvolume  show  path-to-subvolume
command.

I also noticed that is does not appear to be in the git.

This looks like a useful capability.  I was trying to find out what the 
UUID was for a newly created subvolume and have not found out how to do 
that.


Gene
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: subvolume show

2012-12-12 Thread Hugo Mills
On Wed, Dec 12, 2012 at 01:22:40PM -0500, Gene Czarcinski wrote:
 I was looking through some of the archives and notice a patch
 submitted to implement:
   btrfs  subvolume  show  path-to-subvolume
 command.
 
 I also noticed that is does not appear to be in the git.
 
 This looks like a useful capability.  I was trying to find out what
 the UUID was for a newly created subvolume and have not found out
 how to do that.

   Subvolumes don't have independent UUIDs, that's probably why...

   They have unique IDs, which you can see with btrfs sub list
/mountpoint, and use those IDs to identify which subvolume to mount
with -o subvolid=...

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
   --- emacs: Emacs Makes A Computer Slow. ---   


signature.asc
Description: Digital signature