Re: Fix of sysctl.c rev. 1.191 related bug and unbreak diskless(8)

2013-07-17 Thread Philip Guenther
On Wed, Jul 17, 2013 at 8:55 PM, Rafael Neves  wrote:
...
> If my hypothesis about code's design is correct the patch below might
> be more suitable. It brings your mib[3] fix back to vfsinit()
> (reverting rev1.191) and adds one more element on vfsvars and vfsname
> to account for the offset. The major drawback is that it allocates
> more memory than is actually needed and as I understand memory is very
> precious on some archs. Despite this drawback, it passes on the
> negative test, solves the filesystem accounting problem (even with
> FUSE enabled).

Hmm, I think I like you diff.

But here's a challenge for you: there's a case when your diff would be
better than mine, returning correct info that mine wouldn't.  Do you
understand your own diff well enough to be able to what that case is?


Philip Guenther



Re: Fix of sysctl.c rev. 1.191 related bug and unbreak diskless(8)

2013-07-17 Thread Rafael Neves
On 7/15/13, Philip Guenther  wrote:
> On Sun, Jul 14, 2013 at 12:54 AM, Rafael Neves 
> wrote:
>> The patch below fixes a bug on sysctl(8) introduced by revision 1.191
>> of sysctl.c. After rev1.191, `sysctl vfs' mangles information about
>> filesystems (mounted instances of ffs are attributed to nfs, of nfs
>> are atrributed to mfs, and so on). As a consequence, `sysctl
>> vfs.mounts.nfs' reports 0 mounted instances on a diskless(8) setup,
>> thus /etc/rc script (lines 335 to 342) doesn't add pf rules that allow
>> NFS, and system hangs when it enables pf.
>
> First off: thank you for (a) noticing this, and (b) tracking down the
> mismatch.
>
> ...
>> --- sysctl.c9 Jun 2013 12:54:38 -   1.192
>> +++ sysctl.c14 Jul 2013 07:09:28 -
>> @@ -1175,8 +1175,8 @@ vfsinit(void)
>>
>> vfsname[0].ctl_name = "mounts";
>> vfsname[0].ctl_type = CTLTYPE_NODE;
>> -   vfsvars[0].list = vfsname + 1;
>> -   vfsvars[0].size = maxtypenum - 1;
>> +   vfsvars[0].list = vfsname;
>> +   vfsvars[0].size = maxtypenum;
>
> Soo close...
>
> While this fixes the observed problem, it's not 100% correct.  The
> glitch is that it fails a negative test: the command
>  sysctl vfs.mounts.mounts
> should fail with the error
>  sysctl: third level name mounts in vfs.mounts.mounts is invalid
>

Great catch! You're totally right. Thank you for point it out.

> but with your patch it silently succeeds.  The vfsname list is offset
> by one in vfsvars[0].list to prevent that, so the fix that avoids the
> unwanted match against vfsname[0] is to keep the offset, but undo it
> in the lookup:

Aaahhh, now I understand why that line of code and why the pointer
calculation doesn't take a multiple of struct size or something like
that. Many thanks, I never would figure it out alone.

>
> --- sysctl.c9 Jun 2013 12:54:38 -   1.192
> +++ sysctl.c15 Jul 2013 03:43:27 -
> @@ -1200,7 +1200,7 @@ sysctl_vfsgen(char *string, char **bufpp
>
> mib[1] = VFS_GENERIC;
> mib[2] = VFS_CONF;
> -   mib[3] = indx;
> +   mib[3] = indx + 1;
> size = sizeof vfc;
> if (sysctl(mib, 4, &vfc, &size, (void *)0, (size_t)0) < 0) {
> if (errno != EOPNOTSUPP)
>
>
> That make sense?
>

Yes, it does. Actually, first I thought to change sysctl_vfsgen() to
take account the new index scheme of vfsvars, but reading the other
sections sysctl.c code I find that generally findname() result is used
untouched (for example, as a input for sysctl(3)) in the code, and I
thought that change might be much intrusive. I think that behavior is
intentional, so all tricks needed to findname() results be meaningful
has to be done when generating the list, and not when using the
findname() returned value.

If my hypothesis about code's design is correct the patch below might
be more suitable. It brings your mib[3] fix back to vfsinit()
(reverting rev1.191) and adds one more element on vfsvars and vfsname
to account for the offset. The major drawback is that it allocates
more memory than is actually needed and as I understand memory is very
precious on some archs. Despite this drawback, it passes on the
negative test, solves the filesystem accounting problem (even with
FUSE enabled).


I'm not sure about correctness of my hypothesis about code's design
nor about that patch is better than simply adjust mib[3] entry, and I
really appreciate opinions on both these issues.

>
> Philip Guenther
>

Many thanks for the review, and sorry for delay!


My results with patch applied (custom kernel with FUSE enabled):
mount(8) output:
/dev/wd0a on / type ffs (local)
/dev/wd0k on /home type ffs (local, nodev, nosuid)
/dev/wd0d on /tmp type ffs (local, nodev, nosuid)
/dev/wd0f on /usr type ffs (local, nodev)
/dev/wd0g on /usr/X11R6 type ffs (local, nodev)
/dev/wd0h on /usr/local type ffs (local, nodev)
/dev/wd0j on /usr/obj type ffs (local, nodev, nosuid)
/dev/wd0e on /var type ffs (local, nodev, nosuid)
/dev/sd2i on /usr/src type ffs (local, nodev, nosuid, softdep)
/dev/sd1a on /mnt type ext2fs (local)

sysctl(8) output:
vfs.mounts.ffs has 9 mounted instances
vfs.mounts.ext2fs has 1 mounted instance
vfs.ffs.doclusterread=1
vfs.ffs.doclusterwrite=1
vfs.ffs.doreallocblks=1
vfs.ffs.doasyncfree=1
vfs.ffs.max_softdeps=23704
vfs.ffs.sd_tickdelay=2
vfs.ffs.sd_worklist_push=0
vfs.ffs.sd_blk_limit_push=0
vfs.ffs.sd_ino_limit_push=0
vfs.ffs.sd_blk_limit_hit=0
vfs.ffs.sd_ino_limit_hit=0
vfs.ffs.sd_sync_limit_hit=0
vfs.ffs.sd_indir_blk_ptrs=0
vfs.ffs.sd_inode_bitmap=5
vfs.ffs.sd_direct_blk_ptrs=4
vfs.ffs.sd_dir_entry=2
vfs.ffs.dirhash_dirsize=2560
vfs.ffs.dirhash_maxmem=2097152
vfs.ffs.dirhash_mem=50559
vfs.nfs.iothreads=-1
vfs.fuse.fuse

Re: Fix of sysctl.c rev. 1.191 related bug and unbreak diskless(8)

2013-07-16 Thread Jérémie Courrèges-Anglas
Philip Guenther  writes:

> On Sun, Jul 14, 2013 at 12:54 AM, Rafael Neves  wrote:
>> The patch below fixes a bug on sysctl(8) introduced by revision 1.191
>> of sysctl.c. After rev1.191, `sysctl vfs' mangles information about
>> filesystems (mounted instances of ffs are attributed to nfs, of nfs
>> are atrributed to mfs, and so on). As a consequence, `sysctl
>> vfs.mounts.nfs' reports 0 mounted instances on a diskless(8) setup,
>> thus /etc/rc script (lines 335 to 342) doesn't add pf rules that allow
>> NFS, and system hangs when it enables pf.
>
> First off: thank you for (a) noticing this, and (b) tracking down the 
> mismatch.
>
> ...
>> --- sysctl.c9 Jun 2013 12:54:38 -   1.192
>> +++ sysctl.c14 Jul 2013 07:09:28 -
>> @@ -1175,8 +1175,8 @@ vfsinit(void)
>>
>> vfsname[0].ctl_name = "mounts";
>> vfsname[0].ctl_type = CTLTYPE_NODE;
>> -   vfsvars[0].list = vfsname + 1;
>> -   vfsvars[0].size = maxtypenum - 1;
>> +   vfsvars[0].list = vfsname;
>> +   vfsvars[0].size = maxtypenum;
>
> Soo close...
>
> While this fixes the observed problem, it's not 100% correct.  The
> glitch is that it fails a negative test: the command
>  sysctl vfs.mounts.mounts
> should fail with the error
>  sysctl: third level name mounts in vfs.mounts.mounts is invalid
>
> but with your patch it silently succeeds.  The vfsname list is offset
> by one in vfsvars[0].list to prevent that, so the fix that avoids the
> unwanted match against vfsname[0] is to keep the offset, but undo it
> in the lookup:
>
> --- sysctl.c9 Jun 2013 12:54:38 -   1.192
> +++ sysctl.c15 Jul 2013 03:43:27 -
> @@ -1200,7 +1200,7 @@ sysctl_vfsgen(char *string, char **bufpp
>
> mib[1] = VFS_GENERIC;
> mib[2] = VFS_CONF;
> -   mib[3] = indx;
> +   mib[3] = indx + 1;
> size = sizeof vfc;
> if (sysctl(mib, 4, &vfc, &size, (void *)0, (size_t)0) < 0) {
> if (errno != EOPNOTSUPP)
>
>
> That makes sense?

It does make sense to me. ok jca@

-- 
Jérémie Courrèges-Anglas
PGP Key fingerprint: 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494



Re: Fix of sysctl.c rev. 1.191 related bug and unbreak diskless(8)

2013-07-15 Thread RD Thrush
On 07/14/13 23:50, Philip Guenther wrote:
> On Sun, Jul 14, 2013 at 12:54 AM, Rafael Neves  wrote:
>> The patch below fixes a bug on sysctl(8) introduced by revision 1.191
>> of sysctl.c. After rev1.191, `sysctl vfs' mangles information about
>> filesystems (mounted instances of ffs are attributed to nfs, of nfs
>> are atrributed to mfs, and so on). As a consequence, `sysctl
>> vfs.mounts.nfs' reports 0 mounted instances on a diskless(8) setup,
>> thus /etc/rc script (lines 335 to 342) doesn't add pf rules that allow
>> NFS, and system hangs when it enables pf.
> 
> First off: thank you for (a) noticing this, and (b) tracking down the 
> mismatch.
> 
> ...
>> --- sysctl.c9 Jun 2013 12:54:38 -   1.192
>> +++ sysctl.c14 Jul 2013 07:09:28 -
>> @@ -1175,8 +1175,8 @@ vfsinit(void)
>>
>> vfsname[0].ctl_name = "mounts";
>> vfsname[0].ctl_type = CTLTYPE_NODE;
>> -   vfsvars[0].list = vfsname + 1;
>> -   vfsvars[0].size = maxtypenum - 1;
>> +   vfsvars[0].list = vfsname;
>> +   vfsvars[0].size = maxtypenum;
> 
> Soo close...
> 
> While this fixes the observed problem, it's not 100% correct.  The
> glitch is that it fails a negative test: the command
>  sysctl vfs.mounts.mounts
> should fail with the error
>  sysctl: third level name mounts in vfs.mounts.mounts is invalid
> 
> but with your patch it silently succeeds.  The vfsname list is offset
> by one in vfsvars[0].list to prevent that, so the fix that avoids the
> unwanted match against vfsname[0] is to keep the offset, but undo it
> in the lookup:
> 
> --- sysctl.c9 Jun 2013 12:54:38 -   1.192
> +++ sysctl.c15 Jul 2013 03:43:27 -
> @@ -1200,7 +1200,7 @@ sysctl_vfsgen(char *string, char **bufpp
> 
> mib[1] = VFS_GENERIC;
> mib[2] = VFS_CONF;
> -   mib[3] = indx;
> +   mib[3] = indx + 1;
> size = sizeof vfc;
> if (sysctl(mib, 4, &vfc, &size, (void *)0, (size_t)0) < 0) {
> if (errno != EOPNOTSUPP)
> 
> 
> That make sense?

Sorry, I previously replied to the wrong list...

Your patch produces correct results for my previous report.  Without repeating
that email, here's the current summary:

172>diff -wbu before after
--- before  Mon Jul 15 05:53:23 2013
+++ after   Mon Jul 15 05:53:58 2013
@@ -17,9 +17,9 @@
 a8v:/pub2 on /a8v/pub2 type nfs (nodev, nosuid, read-only, v3, udp, timeo=100,
retrans=101)
 nas2:/work on /nas2/work type nfs (nodev, nosuid, v3, udp, timeo=100, 
retrans=101)
 nas2:/media on /nas2/media type nfs (nodev, nosuid, v3, udp, rdirsize=4096,
timeo=100, retrans=101)
-vfs.mounts.nfs has 12 mounted instances
-vfs.mounts.mfs has 6 mounted instances
-vfs.mounts.msdos has 1 mounted instance
+vfs.mounts.ffs has 12 mounted instances
+vfs.mounts.nfs has 6 mounted instances
+vfs.mounts.mfs has 1 mounted instance
 vfs.ffs.doclusterread=1
 vfs.ffs.doclusterwrite=1
 vfs.ffs.doreallocblks=1

Thanks.



Re: Fix of sysctl.c rev. 1.191 related bug and unbreak diskless(8)

2013-07-14 Thread Philip Guenther
On Sun, Jul 14, 2013 at 12:54 AM, Rafael Neves  wrote:
> The patch below fixes a bug on sysctl(8) introduced by revision 1.191
> of sysctl.c. After rev1.191, `sysctl vfs' mangles information about
> filesystems (mounted instances of ffs are attributed to nfs, of nfs
> are atrributed to mfs, and so on). As a consequence, `sysctl
> vfs.mounts.nfs' reports 0 mounted instances on a diskless(8) setup,
> thus /etc/rc script (lines 335 to 342) doesn't add pf rules that allow
> NFS, and system hangs when it enables pf.

First off: thank you for (a) noticing this, and (b) tracking down the mismatch.

...
> --- sysctl.c9 Jun 2013 12:54:38 -   1.192
> +++ sysctl.c14 Jul 2013 07:09:28 -
> @@ -1175,8 +1175,8 @@ vfsinit(void)
>
> vfsname[0].ctl_name = "mounts";
> vfsname[0].ctl_type = CTLTYPE_NODE;
> -   vfsvars[0].list = vfsname + 1;
> -   vfsvars[0].size = maxtypenum - 1;
> +   vfsvars[0].list = vfsname;
> +   vfsvars[0].size = maxtypenum;

Soo close...

While this fixes the observed problem, it's not 100% correct.  The
glitch is that it fails a negative test: the command
 sysctl vfs.mounts.mounts
should fail with the error
 sysctl: third level name mounts in vfs.mounts.mounts is invalid

but with your patch it silently succeeds.  The vfsname list is offset
by one in vfsvars[0].list to prevent that, so the fix that avoids the
unwanted match against vfsname[0] is to keep the offset, but undo it
in the lookup:

--- sysctl.c9 Jun 2013 12:54:38 -   1.192
+++ sysctl.c15 Jul 2013 03:43:27 -
@@ -1200,7 +1200,7 @@ sysctl_vfsgen(char *string, char **bufpp

mib[1] = VFS_GENERIC;
mib[2] = VFS_CONF;
-   mib[3] = indx;
+   mib[3] = indx + 1;
size = sizeof vfc;
if (sysctl(mib, 4, &vfc, &size, (void *)0, (size_t)0) < 0) {
if (errno != EOPNOTSUPP)


That make sense?


Philip Guenther



Re: Fix of sysctl.c rev. 1.191 related bug and unbreak diskless(8)

2013-07-14 Thread RD Thrush
Your patch applies correctly.

5>sysctl kern.version
kern.version=OpenBSD 5.4-beta (GENERIC.MP) #27: Fri Jul 12 10:35:54 MDT 2013
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
6>mount
/dev/sd0a on / type ffs (local, softdep)
mfs:26558 on /tmp type mfs (asynchronous, local, nodev, nosuid, size=512000 
1K-blocks)
/dev/sd0d on /usr type ffs (local, nodev, read-only)
/dev/sd2l on /usr/local type ffs (local, nodev, read-only)
/dev/sd0e on /var type ffs (local, nodev, nosuid, softdep)
/dev/sd2h on /home type ffs (local, nodev, nosuid, softdep)
/dev/sd2p on /pub type ffs (NFS exported, local, nodev, nosuid, softdep)
/dev/sd3p on /v type ffs (NFS exported, local, nodev, nosuid)
/dev/wd0m on /var/crash type ffs (local, nodev, nosuid, softdep)
/dev/wd0o on /usr/obj type ffs (asynchronous, local, noatime, nodev)
/dev/sd1d on /cosmo-rescue type ffs (local, nodev, nosuid, read-only, softdep)
/dev/sd1e on /another-rescue type ffs (local, nodev, nosuid, read-only, softdep)
/dev/sd1f on /p type ffs (NFS exported, local, nodev, nosuid, read-only, 
softdep)
localhost:/pub/cvsroot on /var/www/cvs type nfs (nosuid, read-only, v3, udp, 
timeo=100, retrans=101)
localhost:/pub/src on /var/www/htdocs/src type nfs (nosuid, read-only, v3, udp, 
timeo=100, retrans=101)
a8v:/pub on /a8v/pub type nfs (nodev, nosuid, read-only, v3, udp, timeo=100, 
retrans=101)
a8v:/pub2 on /a8v/pub2 type nfs (nodev, nosuid, read-only, v3, udp, timeo=100, 
retrans=101)
nas2:/work on /nas2/work type nfs (nodev, nosuid, v3, udp, timeo=100, 
retrans=101)
7>sysctl vfs | tee before
vfs.mounts.nfs has 12 mounted instances
vfs.mounts.mfs has 5 mounted instances
vfs.mounts.msdos has 1 mounted instance
vfs.ffs.doclusterread=1
vfs.ffs.doclusterwrite=1
vfs.ffs.doreallocblks=1
vfs.ffs.doasyncfree=1
vfs.ffs.max_softdeps=23704
vfs.ffs.sd_tickdelay=2
vfs.ffs.sd_worklist_push=0
vfs.ffs.sd_blk_limit_push=0
vfs.ffs.sd_ino_limit_push=0
vfs.ffs.sd_blk_limit_hit=0
vfs.ffs.sd_ino_limit_hit=0
vfs.ffs.sd_sync_limit_hit=0
vfs.ffs.sd_indir_blk_ptrs=43
vfs.ffs.sd_inode_bitmap=66
vfs.ffs.sd_direct_blk_ptrs=427
vfs.ffs.sd_dir_entry=35
vfs.ffs.dirhash_dirsize=2560
vfs.ffs.dirhash_maxmem=2097152
vfs.ffs.dirhash_mem=236147
vfs.nfs.iothreads=4
8>/usr/src/sbin/sysctl/obj/sysctl vfs | tee after
vfs.mounts.ffs has 12 mounted instances
vfs.mounts.nfs has 5 mounted instances
vfs.mounts.mfs has 1 mounted instance
vfs.ffs.doclusterread=1
vfs.ffs.doclusterwrite=1
vfs.ffs.doreallocblks=1
vfs.ffs.doasyncfree=1
vfs.ffs.max_softdeps=23704
vfs.ffs.sd_tickdelay=2
vfs.ffs.sd_worklist_push=0
vfs.ffs.sd_blk_limit_push=0
vfs.ffs.sd_ino_limit_push=0
vfs.ffs.sd_blk_limit_hit=0
vfs.ffs.sd_ino_limit_hit=0
vfs.ffs.sd_sync_limit_hit=0
vfs.ffs.sd_indir_blk_ptrs=43
vfs.ffs.sd_inode_bitmap=68
vfs.ffs.sd_direct_blk_ptrs=427
vfs.ffs.sd_dir_entry=37
vfs.ffs.dirhash_dirsize=2560
vfs.ffs.dirhash_maxmem=2097152
vfs.ffs.dirhash_mem=241014
vfs.nfs.iothreads=4
9>diff -wbu before after
--- before  Sun Jul 14 06:27:13 2013
+++ after   Sun Jul 14 06:31:50 2013
@@ -16,9 +16,9 @@
 a8v:/pub on /a8v/pub type nfs (nodev, nosuid, read-only, v3, udp, timeo=100, 
retrans=101)
 a8v:/pub2 on /a8v/pub2 type nfs (nodev, nosuid, read-only, v3, udp, timeo=100, 
retrans=101)
 nas2:/work on /nas2/work type nfs (nodev, nosuid, v3, udp, timeo=100, 
retrans=101)
-vfs.mounts.nfs has 12 mounted instances
-vfs.mounts.mfs has 5 mounted instances
-vfs.mounts.msdos has 1 mounted instance
+vfs.mounts.ffs has 12 mounted instances
+vfs.mounts.nfs has 5 mounted instances
+vfs.mounts.mfs has 1 mounted instance
 vfs.ffs.doclusterread=1
 vfs.ffs.doclusterwrite=1
 vfs.ffs.doreallocblks=1
@@ -32,10 +32,10 @@
 vfs.ffs.sd_ino_limit_hit=0
 vfs.ffs.sd_sync_limit_hit=0
 vfs.ffs.sd_indir_blk_ptrs=43
-vfs.ffs.sd_inode_bitmap=67
+vfs.ffs.sd_inode_bitmap=68
 vfs.ffs.sd_direct_blk_ptrs=427
-vfs.ffs.sd_dir_entry=36
+vfs.ffs.sd_dir_entry=37
 vfs.ffs.dirhash_dirsize=2560
 vfs.ffs.dirhash_maxmem=2097152
-vfs.ffs.dirhash_mem=236147
+vfs.ffs.dirhash_mem=241014
 vfs.nfs.iothreads=4

Thanks.

On 07/14/13 03:54, Rafael Neves wrote:
> Hi tech@,
> 
> The patch below fixes a bug on sysctl(8) introduced by revision 1.191
> of sysctl.c. After rev1.191, `sysctl vfs' mangles information about
> filesystems (mounted instances of ffs are attributed to nfs, of nfs
> are atrributed to mfs, and so on). As a consequence, `sysctl
> vfs.mounts.nfs' reports 0 mounted instances on a diskless(8) setup,
> thus /etc/rc script (lines 335 to 342) doesn't add pf rules that allow
> NFS, and system hangs when it enables pf.
> 
> For example, on -current I get (dmesg at end):
> output of mount(8):
>   /dev/wd0a on / type ffs (local)
>   /dev/wd0k on /home type ffs (local, nodev, nosuid)
>   /dev/wd0d on /tmp type ffs (local, nodev, nosuid)
>   /dev/wd0f on /usr type ffs (local, nodev)
>   /dev/wd0g on /usr/X11R6 type ffs (local, nodev)
>   /dev/wd0h on /usr/local type ffs (local, nodev)
>   /dev/wd0j on /usr/obj type ffs (local, nodev, no

Fix of sysctl.c rev. 1.191 related bug and unbreak diskless(8)

2013-07-14 Thread Rafael Neves
Hi tech@,

The patch below fixes a bug on sysctl(8) introduced by revision 1.191
of sysctl.c. After rev1.191, `sysctl vfs' mangles information about
filesystems (mounted instances of ffs are attributed to nfs, of nfs
are atrributed to mfs, and so on). As a consequence, `sysctl
vfs.mounts.nfs' reports 0 mounted instances on a diskless(8) setup,
thus /etc/rc script (lines 335 to 342) doesn't add pf rules that allow
NFS, and system hangs when it enables pf.

For example, on -current I get (dmesg at end):
output of mount(8):
/dev/wd0a on / type ffs (local)
/dev/wd0k on /home type ffs (local, nodev, nosuid)
/dev/wd0d on /tmp type ffs (local, nodev, nosuid)
/dev/wd0f on /usr type ffs (local, nodev)
/dev/wd0g on /usr/X11R6 type ffs (local, nodev)
/dev/wd0h on /usr/local type ffs (local, nodev)
/dev/wd0j on /usr/obj type ffs (local, nodev, nosuid)
/dev/wd0e on /var type ffs (local, nodev, nosuid)
/dev/sd1i on /usr/src type ffs (local, nodev, nosuid, softdep)
/dev/sd2a on /mnt2 type ext2fs (local)

output of sysctl(8) (`sysctl vfs'):
vfs.mounts.nfs has 9 mounted instances
vfs.ffs.doclusterread=1
vfs.ffs.doclusterwrite=1
vfs.ffs.doreallocblks=1
vfs.ffs.doasyncfree=1
vfs.ffs.max_softdeps=23704
vfs.ffs.sd_tickdelay=2
vfs.ffs.sd_worklist_push=0
vfs.ffs.sd_blk_limit_push=0
vfs.ffs.sd_ino_limit_push=0
vfs.ffs.sd_blk_limit_hit=0
vfs.ffs.sd_ino_limit_hit=0
vfs.ffs.sd_sync_limit_hit=0
vfs.ffs.sd_indir_blk_ptrs=0
vfs.ffs.sd_inode_bitmap=37
vfs.ffs.sd_direct_blk_ptrs=26
vfs.ffs.sd_dir_entry=14
vfs.ffs.dirhash_dirsize=2560
vfs.ffs.dirhash_maxmem=2097152
vfs.ffs.dirhash_mem=325453
vfs.nfs.iothreads=-1


The problem is that sysctl(8) expects that vfsvars->list[] and
filesystem indexes match, so findname() result could be used in
sysctl(2) to get filesystem information. Currently, it is not the case
because vfsvars->list[] is filled with:
vfsvars->list[0].ctl_name = ffs
vfsvars->list[1].ctl_name = nfs
vfsvars->list[2].ctl_name = mfs
vfsvars->list[3].ctl_name = msdos
vfsvars->list[4].ctl_name = NULL
vfsvars->list[5].ctl_name = ntfs
vfsvars->list[6].ctl_name = NULL
vfsvars->list[7].ctl_name = NULL
vfsvars->list[8].ctl_name = NULL
vfsvars->list[9].ctl_name = NULL
vfsvars->list[10].ctl_name = NULL
vfsvars->list[11].ctl_name = procfs
vfsvars->list[12].ctl_name = udf
vfsvars->list[13].ctl_name = cd9660
vfsvars->list[14].ctl_name = NULL
vfsvars->list[15].ctl_name = NULL
vfsvars->list[16].ctl_name = ext2fs


The patch completes the off-by-one adjust needed to access the last
filesystem and works with FUSE enabled. After the patch I get:
vfs.mounts.ffs has 9 mounted instances
vfs.mounts.ext2fs has 1 mounted instance
vfs.ffs.doclusterread=1
vfs.ffs.doclusterwrite=1
vfs.ffs.doreallocblks=1
vfs.ffs.doasyncfree=1
vfs.ffs.max_softdeps=23704
vfs.ffs.sd_tickdelay=2
vfs.ffs.sd_worklist_push=0
vfs.ffs.sd_blk_limit_push=0
vfs.ffs.sd_ino_limit_push=0
vfs.ffs.sd_blk_limit_hit=0
vfs.ffs.sd_ino_limit_hit=0
vfs.ffs.sd_sync_limit_hit=0
vfs.ffs.sd_indir_blk_ptrs=0
vfs.ffs.sd_inode_bitmap=37
vfs.ffs.sd_direct_blk_ptrs=26
vfs.ffs.sd_dir_entry=14
vfs.ffs.dirhash_dirsize=2560
vfs.ffs.dirhash_maxmem=2097152
vfs.ffs.dirhash_mem=325453
vfs.nfs.iothreads=-1

Thanks in advance for any comments.

Regards
Rafael Neves

dmesg:
OpenBSD 5.3-current (GENERIC) #15: Thu Jul  4 11:52:29 MDT 2013
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel(R) Pentium(R) 4 CPU 1.80GHz ("GenuineIntel" 686-class) 1.81 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PERF
real mem  = 771223552 (735MB)
avail mem = 747171840 (712MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 03/10/03, BIOS32 rev. 0 @
0xfdad0, SMBIOS rev. 2.3 @ 0xf0630 (19 entries)
bios0: vendor American Megatrends Inc. version "07.00T" date 04/02/01
bios0: ECS P4VMM2
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S4 S5
acpi0: tables DSDT FACP
acpi0: wakeup devices UAR1(S4) USB1(S4) USB2(S4) USB3(S4) EHCI(S4)
AC9_(S4) MC9_(S4) ILAN(S4) PCI0(S4) SLPB(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiprt0 at acpi0: bus 0 (PCI0)
acpicpu0 at acpi0
acpipwrres0 at acpi0: URP1
acpipwrres1 at acpi0: URP2
acpipwrres2 at acpi0: FDDP
acpipwrres3 at acpi0: LPTP
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: SLPB
bios0: ROM list: 0xc/0xc000 0xcc000/0x4000!
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "VIA V