statvfs: fix bsize and frsize mixup
authorBjörn Jacke <bjacke@samba.org>
Tue, 8 Jan 2019 09:38:06 +0000 (10:38 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 10 Jan 2019 08:40:06 +0000 (09:40 +0100)
the block size (the real one) is the "fundamental file system block size" and
that is the frsize struct member in the statvfs struct. The bsize struct member
of the statvfs struct is *different* from the same named one of the statfs
struct.

See also http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_statvfs.h.html

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11810

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jan 10 09:40:06 CET 2019 on sn-devel-144

source3/smbd/statvfs.c

index d4bdf1629f2368126551ffa820848cfdb9d8a3cd..2312d2c8240477c2e8ddf0f079ed37f5662a9f7b 100644 (file)
@@ -123,8 +123,10 @@ static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf)
        result = statvfs(path, &statvfs_buf);
 
        if (!result) {
-               statbuf->OptimalTransferSize = statvfs_buf.f_frsize;
-               statbuf->BlockSize = statvfs_buf.f_bsize;
+               /* statvfs bsize is not the statfs bsize, the naming is terrible,
+                * see bug 11810 */
+               statbuf->OptimalTransferSize = statvfs_buf.f_bsize;
+               statbuf->BlockSize = statvfs_buf.f_frsize;
                statbuf->TotalBlocks = statvfs_buf.f_blocks;
                statbuf->BlocksAvail = statvfs_buf.f_bfree;
                statbuf->UserBlocksAvail = statvfs_buf.f_bavail;