]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Raise fake free space reporting
authorAndrew Deason <adeason@sinenomine.net>
Wed, 27 Mar 2013 23:12:41 +0000 (18:12 -0500)
committerD Brashear <shadow@your-file-system.com>
Fri, 4 Apr 2014 15:47:35 +0000 (08:47 -0700)
We report 'fake' values for free space, free file nodes, etc for the
'AFS' filesystem, since these values are not meaningful for AFS
itself. Currently we report about 9G of free space for most platforms,
and a few different values for a few others. Raise all of these to
2^32-1, so that trying to copy over 9G of data into AFS does not fail
for those applications that check the destination free space with
statfs(2). Note that one such application is KDE 4.8.x.

Consolidate all places that do this, and put the 'fake' value in one
place, AFS_VFS_FAKEFREE, along with the relevant comments.

Related issues reported by Lars Schimmer, Richard Brittain, and
others.

Change-Id: Ia15175da32744e11f62489c29bedfe1f5560d2b4
Reviewed-on: http://gerrit.openafs.org/9688
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Markus Koeberl <markus.koeberl@tugraz.at>
Tested-by: Markus Koeberl <markus.koeberl@tugraz.at>
Reviewed-by: D Brashear <shadow@your-file-system.com>
12 files changed:
src/afs/AIX/osi_vfsops.c
src/afs/DARWIN/osi_vfsops.c
src/afs/FBSD/osi_vfsops.c
src/afs/HPUX/osi_vfsops.c
src/afs/IRIX/osi_vfsops.c
src/afs/LINUX/osi_vfsops.c
src/afs/LINUX24/osi_vfsops.c
src/afs/NBSD/osi_vfsops.c
src/afs/OBSD/osi_vfsops.c
src/afs/SOLARIS/osi_vfsops.c
src/afs/UKERNEL/osi_vfsops.c
src/afs/afs.h

index c24fc6edafe9765902cfb43182e4268399f196ae..32fbbf5c8a0f702b3963990f084d5b81661555ba 100644 (file)
@@ -174,7 +174,7 @@ afs_statfs(struct vfs *afsp, struct statfs *abp, struct ucred *credp)
     abp->f_type = 0;
     abp->f_bsize = afsp->vfs_bsize;
     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
-       abp->f_ffree = 9000000;
+       abp->f_ffree = AFS_VFS_FAKEFREE;
     abp->f_vfstype = AFS_VFSFSID;
     abp->f_vfsnumber = afsp->vfs_number;
     abp->f_vfsoff = abp->f_vfslen = abp->f_vfsvers = -1;
index d0efb8c2d3781bcd578af0e253e929fcf6fd394b..22cfeba3d31e433ed525475c3940a7417bf92e40 100644 (file)
@@ -361,12 +361,8 @@ afs_statfs(struct mount *mp, STATFS_TYPE *abp, CTX_TYPE ctx)
     abp->f_type = MOUNT_AFS;
 #endif
 
-    /* Fake a high number below to satisfy programs that use the statfs call
-     * to make sure that there's enough space in the device partition before
-     * storing something there.
-     */
     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
-      abp->f_ffree = 0x7fffffff;
+      abp->f_ffree = AFS_VFS_FAKEFREE;
 
     if (abp != sysstat) {
         abp->f_fsid.val[0] = sysstat->f_fsid.val[0];
index 0878e65d72d01665a55cc45718539f0e073b5a7b..54d33668ce653e81e64de762f80d693c9d693138 100644 (file)
@@ -338,12 +338,8 @@ afs_statfs(struct mount *mp, struct statfs *abp, struct thread *p)
     abp->f_bsize = mp->vfs_bsize;
     abp->f_iosize = mp->vfs_bsize;
 
-    /* Fake a high number below to satisfy programs that use the statfs call
-     * to make sure that there's enough space in the device partition before
-     * storing something there.
-     */
     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
-       abp->f_ffree = 2000000;
+       abp->f_ffree = AFS_VFS_FAKEFREE;
 
     abp->f_fsid.val[0] = mp->mnt_stat.f_fsid.val[0];
     abp->f_fsid.val[1] = mp->mnt_stat.f_fsid.val[1];
index acb601bd3809bf984fa27288957a04db0d5e2126..ca5de57fd54dcec728761baad8b638c11fa3f9c1 100644 (file)
@@ -165,7 +165,7 @@ afs_statfs(struct vfs *afsp, struct k_statvfs *abp)
      * before storing something there.
      */
     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
-       abp->f_ffree = abp->f_favail = 9000000;
+       abp->f_ffree = abp->f_favail = AFS_VFS_FAKEFREE;
     abp->f_fsid = (AFS_VFSMAGIC << 16) || AFS_VFSFSID;
 
     AFS_GUNLOCK();
index b876f3f4910c2ce36ee9ddf09c8694c696661371..bc129d62dd7d6a18a396821ea98b88f8aca8abab 100644 (file)
@@ -313,7 +313,7 @@ afs_statfs(OSI_VFS_ARG(afsp), abp, avp)
      * before storing something there.
      */
     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
-       abp->f_ffree = abp->f_favail = 900000;
+       abp->f_ffree = abp->f_favail = AFS_VFS_FAKEFREE;
 
     abp->f_fsid = AFS_VFSMAGIC;        /* magic */
     strcpy(abp->f_basetype, AFS_MOUNT_AFS);
index cad22a1584b43bf72260e898c44aec91a8558c7d..cad455567e33c8206f27706399e655bc030852ab 100644 (file)
@@ -371,7 +371,7 @@ afs_statfs(struct super_block *sbp, struct kstatfs *statp)
     statp->f_bsize = sbp->s_blocksize;
 #endif
     statp->f_blocks = statp->f_bfree = statp->f_bavail = statp->f_files =
-       statp->f_ffree = 9000000;
+       statp->f_ffree = AFS_VFS_FAKEFREE;
     statp->f_fsid.val[0] = AFS_VFSMAGIC;
     statp->f_fsid.val[1] = AFS_VFSFSID;
     statp->f_namelen = 256;
index 77b821bb2441c3a6112d015c33e92b4a7322ee0e..6c8d29e6f28ed931424d20b531f7b484b5b9fedb 100644 (file)
@@ -345,7 +345,7 @@ afs_statfs(struct super_block *sbp, struct statfs *__statp, int size)
     statp->f_bsize = sbp->s_blocksize;
 #endif
     statp->f_blocks = statp->f_bfree = statp->f_bavail = statp->f_files =
-       statp->f_ffree = 9000000;
+       statp->f_ffree = AFS_VFS_FAKEFREE;
     statp->f_fsid.val[0] = AFS_VFSMAGIC;
     statp->f_fsid.val[1] = AFS_VFSFSID;
     statp->f_namelen = 256;
index c11d6af6af06e23fa7213f862dfcaa69c00b035d..3e418471faf431944fe4cbd2ed1f57cc2f145ff3 100644 (file)
@@ -422,14 +422,8 @@ afs_statvfs(struct mount *mp, struct statvfs *abp)
     abp->f_frsize = mp->osi_vfs_bsize;
     abp->f_iosize = mp->osi_vfs_bsize;
 
-    /*
-     * Fake a high number below to satisfy programs that use the ustat (for
-     * * AIX), or statfs (for the rest) call to make sure that there's
-     * enough * space in the device partition before storing something there
-     * (like * ed(1))
-     */
     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
-       abp->f_ffree = 9000000;
+       abp->f_ffree = AFS_VFS_FAKEFREE;
 
     return (0);
 }
index 3db75e2a6b3e893da5940a7e35b08c13c1bdcd22..aa2ccb4ff9c9463195f400b5e012c5264c317783 100644 (file)
@@ -375,14 +375,8 @@ afs_statfs(struct osi_vfs *afsp, struct statfs *abp)
     AFS_STATCNT(afs_statfs);
     abp->f_bsize = afsp->osi_vfs_bsize;
 
-    /*
-     * Fake a high number below to satisfy programs that use the ustat (for
-     * * AIX), or statfs (for the rest) call to make sure that there's
-     * enough * space in the device partition before storing something there
-     * (like * ed(1))
-     */
     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
-       abp->f_ffree = 9000000;
+       abp->f_ffree = AFS_VFS_FAKEFREE;
     abp->f_fsid.val[0] = AFS_VFSMAGIC; /* magic */
     abp->f_fsid.val[1] = (int)AFS_VFSFSID;
     return 0;
index ebb5012f9003c477c2b920163634fc0ef163f326..ca2553b22b21ef341eed7b6db95f21f75631d0f1 100644 (file)
@@ -229,10 +229,9 @@ afs_statvfs(struct vfs *afsp, struct statvfs64 *abp)
     AFS_STATCNT(afs_statfs);
 
     abp->f_frsize = 1024;
-    abp->f_favail = 9000000;
     abp->f_bsize = afsp->vfs_bsize;
     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
-       abp->f_ffree = 9000000;
+       abp->f_favail = abp->f_ffree = AFS_VFS_FAKEFREE;
     abp->f_fsid = (AFS_VFSMAGIC << 16) || AFS_VFSFSID;
 
     AFS_GUNLOCK();
index 53dd5efa809224499b3fc92210c7d8333c3b4642..42d25abb283d3dbedb5b7d73d81893bf41e75868 100644 (file)
@@ -121,10 +121,9 @@ afs_statvfs(struct vfs *afsp, struct statvfs *abp)
     AFS_STATCNT(afs_statfs);
 
     abp->f_frsize = 1024;
-    abp->f_favail = 9000000;
     abp->f_bsize = afsp->vfs_bsize;
     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
-      abp->f_ffree = 9000000;
+      abp->f_favail = abp->f_ffree = AFS_VFS_FAKEFREE;
 
 #ifdef AFS_USR_AIX_ENV
     abp->f_fsid.val[0] = AFS_VFSMAGIC;
index fd1c54d8819fdab4f3b63b1f8c30c8622c2b04e3..fbd542ddb355270578f3deae1ae73c521e87c16b 100644 (file)
@@ -48,6 +48,12 @@ extern int afs_shuttingdown;
 #define        AFS_VFSFSID             AFS_MOUNT_AFS
 #endif
 #endif
+/* use this value for reporting total space, free space, etc.
+ * fake a high number to satisfy programs that use the statfs call to make sure
+ * that there's enough space in the device partition before storing something
+ * there. keep it just under 2^31, to try and be safe about not breaking
+ * stuff that looks at the amount of free space. */
+#define AFS_VFS_FAKEFREE (2147483647)
 
 /* Moved from VNOPS/afs_vnop_flocks so can be used in prototypes */
 #if     defined(AFS_HPUX102_ENV)