linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* list subvolumes with new btrfs command
@ 2010-04-25 18:27 C Anthony Risinger
  2010-04-26  2:09 ` sniper
  0 siblings, 1 reply; 9+ messages in thread
From: C Anthony Risinger @ 2010-04-25 18:27 UTC (permalink / raw)
  To: linux-btrfs

hello,

i maintain an unofficial initrd hook in Arch Linux that allows BTRFS
to be used as the root device.  i am trying to update the hook to use
the more extensive "btrfs" command, adding support for users to change
their default subvolume from within the initrd (i'm creating a sort of
rollback feature, in conjunction with automatic snapshotting via the
package manager), and adding support for hot spares (via a second
BTRFS pool in which devices are "stolen" to repair the primary array).

anyways, i'm having trouble getting a listing of subvolumes:

$ btrfs subvolume list /
ERROR: can't perform the search

the machine has a BTRFS root.  i have also tried creating a snapshot
and pointing the command at that, but i get the same results.  am i
using the command wrong?  relevant code is from btrfs-list.c:

ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args);
if (ret < 0) {
  fprintf(stderr, "ERROR: can't perform the search\n");
  return 0;
}

kernel:

$ uname -r
2.6.33-ARCH

is there a new CONFIG_* kernel parameter that needs to be set since
2.6.32?  everything seems to be in order and working fine... any help
appreciated.

thanks,
C Anthony

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: list subvolumes with new btrfs command
  2010-04-25 18:27 list subvolumes with new btrfs command C Anthony Risinger
@ 2010-04-26  2:09 ` sniper
  2010-04-26  2:47   ` C Anthony Risinger
  0 siblings, 1 reply; 9+ messages in thread
From: sniper @ 2010-04-26  2:09 UTC (permalink / raw)
  To: C Anthony Risinger; +Cc: linux-btrfs

2010/4/26 C Anthony Risinger <anthony@extof.me>:
> hello,
>
> i maintain an unofficial initrd hook in Arch Linux that allows BTRFS
> to be used as the root device. =C2=A0i am trying to update the hook t=
o use
> the more extensive "btrfs" command, adding support for users to chang=
e
> their default subvolume from within the initrd (i'm creating a sort o=
f
> rollback feature, in conjunction with automatic snapshotting via the
> package manager), and adding support for hot spares (via a second
> BTRFS pool in which devices are "stolen" to repair the primary array)=
=2E
>
> anyways, i'm having trouble getting a listing of subvolumes:
>
> $ btrfs subvolume list /
> ERROR: can't perform the search
>
> the machine has a BTRFS root. =C2=A0i have also tried creating a snap=
shot
> and pointing the command at that, but i get the same results. =C2=A0a=
m i
> using the command wrong? =C2=A0relevant code is from btrfs-list.c:
>
> ret =3D ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args);
> if (ret < 0) {
> =C2=A0fprintf(stderr, "ERROR: can't perform the search\n");
> =C2=A0return 0;
> }
>
need super root? in my ubuntu10.04 with latest btrfs-progs:

$ ./btrfs subvolume list /media/sda3-100g/
ERROR: can't perform the search
$ sudo ./btrfs subvolume list /media/sda3-100g/
ID 258 top level 5 path misc/snap/snap-4-26

> kernel:
>
> $ uname -r
> 2.6.33-ARCH
>
> is there a new CONFIG_* kernel parameter that needs to be set since
> 2.6.32? =C2=A0everything seems to be in order and working fine... any=
 help
> appreciated.
>
> thanks,
> C Anthony
> --
> 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 =C2=A0http://vger.kernel.org/majordomo-info.ht=
ml
>
--
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

* Re: list subvolumes with new btrfs command
  2010-04-26  2:09 ` sniper
@ 2010-04-26  2:47   ` C Anthony Risinger
  2010-04-26  3:22     ` sniper
  0 siblings, 1 reply; 9+ messages in thread
From: C Anthony Risinger @ 2010-04-26  2:47 UTC (permalink / raw)
  To: linux-btrfs

> need super root? in my ubuntu10.04 with latest btrfs-progs:
>
> $ ./btrfs subvolume list /media/sda3-100g/
> ERROR: can't perform the search
> $ sudo ./btrfs subvolume list /media/sda3-100g/
> ID 258 top level 5 path misc/snap/snap-4-26

ah sorry, i forgot to mention that it doesn't work as super user
either, same result:

$ sudo btrfs subvolume list /
ERROR: can't perform the search

the btrfs-progs in ubuntu is probably slightly behind git HEAD (what
i'm using in Arch package), maybe it broke recently, i might try to
bisect and see it i can pinpoint to problem commit.  i am also using
kernel 2.6.33 (ubuntu is .32 i think) that's why i thought maybe there
was an issue there; it seems like the ioctl() call is failing no
matter what in my case.

other details i can think of:
1) filesystem was created by a 2.6.31 kernel

i will use loopback + BTRFS to test what is happening here and report
back; maybe i can't scan / ...?  thanks for the response, any other
input is very much appreciated.

thanks,
C Anthony

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: list subvolumes with new btrfs command
  2010-04-26  2:47   ` C Anthony Risinger
@ 2010-04-26  3:22     ` sniper
  2010-04-26 17:23       ` C Anthony Risinger
  0 siblings, 1 reply; 9+ messages in thread
From: sniper @ 2010-04-26  3:22 UTC (permalink / raw)
  To: C Anthony Risinger; +Cc: linux-btrfs

2010/4/26 C Anthony Risinger <anthony@extof.me>:
>> need super root? in my ubuntu10.04 with latest btrfs-progs:
>>
>> $ ./btrfs subvolume list /media/sda3-100g/
>> ERROR: can't perform the search
>> $ sudo ./btrfs subvolume list /media/sda3-100g/
>> ID 258 top level 5 path misc/snap/snap-4-26
>
> ah sorry, i forgot to mention that it doesn't work as super user
> either, same result:
>
> $ sudo btrfs subvolume list /
> ERROR: can't perform the search
>
> the btrfs-progs in ubuntu is probably slightly behind git HEAD (what
> i'm using in Arch package), maybe it broke recently, i might try to
> bisect and see it i can pinpoint to problem commit. =C2=A0i am also u=
sing
> kernel 2.6.33 (ubuntu is .32 i think) that's why i thought maybe ther=
e
> was an issue there; it seems like the ioctl() call is failing no
> matter what in my case.
>
I am using ubuntu-10.04-rc with kernel compiled from the almost
lastest source , the btrfs-progs is latest too.

You can modify line

 fprintf(stderr, "ERROR: can't perform the search\n");
to
 fprintf(stderr, "ERROR: can't perform the search: %s\n", strerror(errn=
o));

to see what happened on earth.
--
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

* Re: list subvolumes with new btrfs command
  2010-04-26  3:22     ` sniper
@ 2010-04-26 17:23       ` C Anthony Risinger
  2010-04-26 17:58         ` Hubert Kario
  0 siblings, 1 reply; 9+ messages in thread
From: C Anthony Risinger @ 2010-04-26 17:23 UTC (permalink / raw)
  To: sniper; +Cc: linux-btrfs

> I am using ubuntu-10.04-rc with kernel compiled from the almost
> lastest source , the btrfs-progs is latest too.
>
> You can modify line
>
> =A0fprintf(stderr, "ERROR: can't perform the search\n");
> to
> =A0fprintf(stderr, "ERROR: can't perform the search: %s\n", strerror(=
errno));
>
> to see what happened on earth.

nice:

$ sudo btrfs subvolume list /
ERROR: can't perform the search: Inappropriate ioctl for device

i'm not really familiar with C, or anything this low level, does this
help you diagnose my problem?

thanks again for the help thus far,
C Anthony
--
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

* Re: list subvolumes with new btrfs command
  2010-04-26 17:23       ` C Anthony Risinger
@ 2010-04-26 17:58         ` Hubert Kario
  2010-04-26 19:10           ` C Anthony Risinger
  0 siblings, 1 reply; 9+ messages in thread
From: Hubert Kario @ 2010-04-26 17:58 UTC (permalink / raw)
  To: C Anthony Risinger; +Cc: sniper, linux-btrfs

On Monday 26 April 2010 19:23:21 C Anthony Risinger wrote:
> > I am using ubuntu-10.04-rc with kernel compiled from the almost
> > lastest source , the btrfs-progs is latest too.
> >
> > You can modify line
> >
> >  fprintf(stderr, "ERROR: can't perform the search\n");
> > to
> >  fprintf(stderr, "ERROR: can't perform the search: %s\n",
> > strerror(errno));
> >
> > to see what happened on earth.
>=20
> nice:
>=20
> $ sudo btrfs subvolume list /
> ERROR: can't perform the search: Inappropriate ioctl for device
>=20
> i'm not really familiar with C, or anything this low level, does this
> help you diagnose my problem?

Have you tried to run it on the device with the btrfs, not the mount po=
int?

It looks like the ioctl was made too restrictive about its arguments.

--=20
Hubert Kario
QBS - Quality Business Software
02-656 Warszawa, ul. Ksawer=C3=B3w 30/85
tel. +48 (22) 646-61-51, 646-74-24
www.qbs.com.pl

System Zarz=C4=85dzania Jako=C5=9Bci=C4=85
zgodny z norm=C4=85 ISO 9001:2000
--
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

* Re: list subvolumes with new btrfs command
  2010-04-26 17:58         ` Hubert Kario
@ 2010-04-26 19:10           ` C Anthony Risinger
  2010-04-26 20:51             ` C Anthony Risinger
  0 siblings, 1 reply; 9+ messages in thread
From: C Anthony Risinger @ 2010-04-26 19:10 UTC (permalink / raw)
  To: Hubert Kario; +Cc: sniper, linux-btrfs

On Mon, Apr 26, 2010 at 12:58 PM, Hubert Kario <hka@qbs.com.pl> wrote:
> On Monday 26 April 2010 19:23:21 C Anthony Risinger wrote:
>> > I am using ubuntu-10.04-rc with kernel compiled from the almost
>> > lastest source , the btrfs-progs is latest too.
>> >
>> > You can modify line
>> >
>> > =A0fprintf(stderr, "ERROR: can't perform the search\n");
>> > to
>> > =A0fprintf(stderr, "ERROR: can't perform the search: %s\n",
>> > strerror(errno));
>> >
>> > to see what happened on earth.
>>
>> nice:
>>
>> $ sudo btrfs subvolume list /
>> ERROR: can't perform the search: Inappropriate ioctl for device
>>
>> i'm not really familiar with C, or anything this low level, does thi=
s
>> help you diagnose my problem?
>
> Have you tried to run it on the device with the btrfs, not the mount =
point?
>
> It looks like the ioctl was made too restrictive about its arguments.

ah yes i missed mentioning that to, tried that:

$ sudo btrfs sub list /dev/sda2
ERROR: '/dev/sda2' is not a subvolume

no dice :(
--
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

* Re: list subvolumes with new btrfs command
  2010-04-26 19:10           ` C Anthony Risinger
@ 2010-04-26 20:51             ` C Anthony Risinger
  2010-04-26 22:14               ` C Anthony Risinger
  0 siblings, 1 reply; 9+ messages in thread
From: C Anthony Risinger @ 2010-04-26 20:51 UTC (permalink / raw)
  To: Hubert Kario; +Cc: sniper, linux-btrfs

On Mon, Apr 26, 2010 at 2:10 PM, C Anthony Risinger <anthony@extof.me> =
wrote:
> On Mon, Apr 26, 2010 at 12:58 PM, Hubert Kario <hka@qbs.com.pl> wrote=
:
>> On Monday 26 April 2010 19:23:21 C Anthony Risinger wrote:
>>> > I am using ubuntu-10.04-rc with kernel compiled from the almost
>>> > lastest source , the btrfs-progs is latest too.
>>> >
>>> > You can modify line
>>> >
>>> > =A0fprintf(stderr, "ERROR: can't perform the search\n");
>>> > to
>>> > =A0fprintf(stderr, "ERROR: can't perform the search: %s\n",
>>> > strerror(errno));
>>> >
>>> > to see what happened on earth.
>>>
>>> nice:
>>>
>>> $ sudo btrfs subvolume list /
>>> ERROR: can't perform the search: Inappropriate ioctl for device
>>>
>>> i'm not really familiar with C, or anything this low level, does th=
is
>>> help you diagnose my problem?
>>
>> Have you tried to run it on the device with the btrfs, not the mount=
 point?
>>
>> It looks like the ioctl was made too restrictive about its arguments=
=2E
>
> ah yes i missed mentioning that to, tried that:
>
> $ sudo btrfs sub list /dev/sda2
> ERROR: '/dev/sda2' is not a subvolume
>
> no dice :(

i tried setting up loopback with a newly formatted btrfs image +
mounting, same result: Inappropriate ioctl for device.  same error
whether i point the command at the default subvolume or a snapshot.
is there anything (missing) i should check in regards to my kernel
(module/progs mismatch)?
--
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

* Re: list subvolumes with new btrfs command
  2010-04-26 20:51             ` C Anthony Risinger
@ 2010-04-26 22:14               ` C Anthony Risinger
  0 siblings, 0 replies; 9+ messages in thread
From: C Anthony Risinger @ 2010-04-26 22:14 UTC (permalink / raw)
  To: Hubert Kario; +Cc: sniper, linux-btrfs

On Mon, Apr 26, 2010 at 3:51 PM, C Anthony Risinger <anthony@extof.me> =
wrote:
> On Mon, Apr 26, 2010 at 2:10 PM, C Anthony Risinger <anthony@extof.me=
> wrote:
>> On Mon, Apr 26, 2010 at 12:58 PM, Hubert Kario <hka@qbs.com.pl> wrot=
e:
>>> On Monday 26 April 2010 19:23:21 C Anthony Risinger wrote:
>>>> > I am using ubuntu-10.04-rc with kernel compiled from the almost
>>>> > lastest source , the btrfs-progs is latest too.
>>>> >
>>>> > You can modify line
>>>> >
>>>> > =A0fprintf(stderr, "ERROR: can't perform the search\n");
>>>> > to
>>>> > =A0fprintf(stderr, "ERROR: can't perform the search: %s\n",
>>>> > strerror(errno));
>>>> >
>>>> > to see what happened on earth.
>>>>
>>>> nice:
>>>>
>>>> $ sudo btrfs subvolume list /
>>>> ERROR: can't perform the search: Inappropriate ioctl for device
>>>>
>>>> i'm not really familiar with C, or anything this low level, does t=
his
>>>> help you diagnose my problem?
>>>
>>> Have you tried to run it on the device with the btrfs, not the moun=
t point?
>>>
>>> It looks like the ioctl was made too restrictive about its argument=
s.
>>
>> ah yes i missed mentioning that to, tried that:
>>
>> $ sudo btrfs sub list /dev/sda2
>> ERROR: '/dev/sda2' is not a subvolume
>>
>> no dice :(
>
> i tried setting up loopback with a newly formatted btrfs image +
> mounting, same result: Inappropriate ioctl for device. =A0same error
> whether i point the command at the default subvolume or a snapshot.
> is there anything (missing) i should check in regards to my kernel
> (module/progs mismatch)?

bleh, looks like my kernel didn't have what it needed; i thought
2.6.33/stock Arch kernel was recent enough.  i booted an 2.6.34rc5
kernel any everything works now:

$ sudo btrfs sub list /
ID 259 top level 5 path vps/var/lib/vps-lxc/tpl/arch-nano
ID 260 top level 5 path vps/var/lib/vps-lxc/dom/dom1

heh, i forgot about those snapshots :-).  i will compensate for this
possibility in my initrd hook.

apologies for the noise.  on a parting note, the "strerror(errno)" was
a nice change, and might be a useful addition for others, as it also
pointed my in the right direction for permission problems (without
sudo/non-super):

$ btrfs sub list /
ERROR: can't perform the search: Operation not permitted

other than that, thanks for the assistance; the new btrfs tool is nice.

C Anthony
--
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-04-26 22:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-25 18:27 list subvolumes with new btrfs command C Anthony Risinger
2010-04-26  2:09 ` sniper
2010-04-26  2:47   ` C Anthony Risinger
2010-04-26  3:22     ` sniper
2010-04-26 17:23       ` C Anthony Risinger
2010-04-26 17:58         ` Hubert Kario
2010-04-26 19:10           ` C Anthony Risinger
2010-04-26 20:51             ` C Anthony Risinger
2010-04-26 22:14               ` C Anthony Risinger

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