GNOME Bugzilla – Bug 528848
[PATCH] statfs lies
Last modified: 2009-01-12 21:24:40 UTC
gvfs-fuse-daemon does, in its statfs function: ... memset (stbuf, 0, sizeof (*stbuf)); stbuf->f_bsize = 4096; stbuf->f_frsize = 4096; /* Ignored by FUSE */ stbuf->f_blocks = 0; stbuf->f_bfree = 0; stbuf->f_bavail = 0; stbuf->f_files = 0; stbuf->f_ffree = 0; stbuf->f_favail = 0; /* Ignored by FUSE */ stbuf->f_fsid = 1; /* Ignored by FUSE */ stbuf->f_flag = 0; /* Ignored by FUSE */ stbuf->f_namemax = 1024; if (statvfs ("/", stbuf) != 0) result = -errno; ... meaning that all the fields about available space, used space, etc. are inherited from the root filesystem. This seems wrong because: 1) ~/.gvfs isn't a normal writable filesystem with space concerns, certainly not until you mount something with it 2) it's not even guaranteed to be on the same filesystem as '/', so using that seems odd in any case Eliding this call leaves the space fields as zero, with the following advantages: - it no longer confuses baobab (yeah, I know) - it doesn't show up in 'df' to confuse users
Created attachment 110050 [details] [review] don't inherit statfs() fields from the root filesystem This removes the statvfs calls, so that statfs() on ~/.gvfs doesn't return the values for the root filesystem.
Is that statfs call mandatory ? I can several python/FUSE fs which don't implement it and are totally OK.
FWIW, this patch looks good to me. I'll ask gicmp for permission to commit it.
Looks good. Thanks for looking David. Please commit.
Why not just drop the statfs impl at all ? stbuf->f_bsize = 4096; stbuf->f_frsize = 4096; /* Ignored by FUSE */ are still lies ...
*** Bug 536606 has been marked as a duplicate of this bug. ***
*ping* can we get this committed please?
2008-07-28 Matthias Clasen <mclasen@redhat.com> Bug 528848 – [PATCH] statfs lies * client/gvfsfusedaemon.c (vfs_statfs): Don't call statvfs on /. Patch by Bill Nottingham.
I suggest that we also don't fake stbuf->f_bsize = 4096; stbuf->f_frsize = 4096; /* Ignored by FUSE */ but rather set them to 0 so that we follow the GNU-df semantic where filesystem with 0 block size are ignored.