]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Never #define away afsd_dynamic_vcaches
authorAndrew Deason <adeason@sinenomine.net>
Wed, 7 Mar 2012 22:36:57 +0000 (16:36 -0600)
committerDerrick Brashear <shadow@dementix.org>
Fri, 16 Mar 2012 02:50:34 +0000 (19:50 -0700)
Some versions of the Solaris Studio compiler on SPARC (at least 12.2
and possibly others, but not 12.3) get a little confused by code like
this:

    extern int foo;
    int
    somefunc(void) {
        if (0) return foo;
        return 0;
    }

When optimization is turned off, this results in an undefined symbol
reference to 'foo' (which is normal), but the resulting object file
lacks a relocation entry for the symbol 'foo', so the symbol remains
undefined after linking. In the OpenAFS tree, this occurs in
afs_daemons.c which references afs_vcount and afs_cacheStats in this
manner due to afsd_dynamic_vcaches being defined as '0' on Solaris.
The end result is that the libafs kernel module is not loadable, since
it complains about afs_vcount and afs_cacheStats being undefined, even
though the symbol definitions are also in the module.

While this is a bug in Solaris Studio and has since been fixed, it is
simple to work around this so we are usable with more compilers. If we
just always declare afsd_dynamic_vcaches as a regular variable, it
works around this issue and keeps the code a tiny bit simpler. So, do
that.

Reviewed-on: http://gerrit.openafs.org/6888
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit e5821239cde138f74f73bec1bd9a3880d08ac3df)

Change-Id: Id0f4b36d2b8d6a18f663ca6c95b78f773255fa78
Reviewed-on: http://gerrit.openafs.org/6908
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
src/afs/afs.h
src/afs/afs_init.c

index a3c838d9b899feb595a448b77b54e31110d12e6b..542617a77694b42cf5c55bdaf3ac5118d0ac4dfa 100644 (file)
@@ -1440,12 +1440,7 @@ struct afs_fakestat_state {
 };
 
 extern int afs_fakestat_enable;
-
-#ifdef AFS_MAXVCOUNT_ENV
 extern int afsd_dynamic_vcaches;
-#else
-#define afsd_dynamic_vcaches 0
-#endif
 
 /*
  * Wrappers for access to credentials structure members
index 5e44fa3d9ecd7fff8bf065574ca54ea36f349c43..748531f79e96d2d018b59bc33dff5eda1996e11c 100644 (file)
@@ -57,9 +57,7 @@ const struct cred *cache_creds;
 #endif
 
 /* This is the kernel side of the dynamic vcache setting */
-#ifdef AFS_MAXVCOUNT_ENV
 int afsd_dynamic_vcaches = 0;  /* Enable dynamic-vcache support */
-#endif
 
 /*
  * Initialization order is important.  Must first call afs_CacheInit,