weird problem with statvfs() on a hammer filesystems

Johannes Hofmann johannes.hofmann at gmx.de
Thu Dec 3 14:36:34 PST 2009


Matthew Dillon <dillon at apollo.backplane.com> wrote:
> 
> :Hi,
> :
> :I'm seeing a weird problem with statvfs() on a hammer filesystems.
> :With this little test program:
> :
> :..
> :
> :I get fsbuf.f_bavail == 0 on a freshly mounted hammer FS:
> 
>    Ach.  I think I see it.  Try the patch below.
> 
>                                                -Matt
> 
> diff --git a/sys/vfs/hammer/hammer_vfsops.c b/sys/vfs/hammer/hammer_vfsops.c
> index fa478bf..79321cd 100644
> --- a/sys/vfs/hammer/hammer_vfsops.c
> +++ b/sys/vfs/hammer/hammer_vfsops.c
> @@ -935,7 +935,7 @@ hammer_vfs_statvfs(struct mount *mp, struct statvfs *sbp, struct ucred *cred)
>        hammer_rel_volume(volume, 0);
> 
>        mp->mnt_vstat.f_bfree = (bfree - breserved) / HAMMER_BUFSIZE;
> -       mp->mnt_vstat.f_bavail = mp->mnt_stat.f_bfree;
> +       mp->mnt_vstat.f_bavail = mp->mnt_vstat.f_bfree;
>        if (mp->mnt_vstat.f_files < 0)
>                mp->mnt_vstat.f_files = 0;
>        *sbp = mp->mnt_vstat;
> 


Haha. That's it. I was staring at this line for quite some time and
started to blame compiler bugs and cosmic rays.

Thanks,
Johannes





More information about the Bugs mailing list