]> 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)
committerStephan Wiesand <stephan.wiesand@desy.de>
Wed, 4 Jun 2014 15:32:45 +0000 (11:32 -0400)
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.

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>
(cherry picked from commit e385571ba37fa6d43fecca17e9e5d60a22a414cd)

Change-Id: Id9b5fa92f48bc83b84bb4f50bc0ae25b028694b0
Reviewed-on: http://gerrit.openafs.org/10984
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
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 b32ad1881ae570c0dc1163b52f1677b1b43cb3cc..860642340c8e2086b35340d8b1dc639210046ee6 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 c4d35ba2357b276ac580e3eaae26c3aeecfe810b..5de249b63608eddae96e67ef4a5db9349c4d011a 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 7aa2a316f55435b7a3b5a6eda65bb9c8c5263183..15839e3d7a98e219c310174d18a6340dcd25a0b3 100644 (file)
@@ -320,7 +320,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 e0bea4825e38f92094b71e6786866f370e39c371..5ae909e008cce4783b1efbc9186c2f87ca93638b 100644 (file)
@@ -364,7 +364,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 922b1d591a9ba51950d6278739f8cae10c0bb631..74da69b12c1ecd84ca3da4e902b2705e7b6f1c3e 100644 (file)
@@ -385,14 +385,8 @@ afs_statvfs(struct mount *mp, struct statvfs *abp, struct lwp *l)
     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 a7e7d1dd03f6ede988e3cc6775b5bccd4527ba14..7fbbcb6bc5ac54207f9d74cb90c8bec4473e59aa 100644 (file)
@@ -250,10 +250,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;
     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 88d5f776331303d0eb4785e95b2deefe2a115070..c2140f898fb82a6e26727c51d35ed8c5ba53756b 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)