* When kill_all_afs is enabled in /etc/openafs/afs.conf, only kill AFS
processes if the runlevel is 0 or 6. You really only want this when
the system is shutting down. (Closes: #325347)
+ * Remove the init script check of the cache file system and instead
+ improve the check in afsd. The init script check used stat, which is
+ in /usr/bin and therefore not fair game for init scripts.
* Translation updates.
- Portuguese (Brazil), thanks André Luís Lopes.
fi
}
-# Make sure that the cache file system type is ext2 or ext3. No other file
-# system is supported for the cache, and generally bad things happen if a
-# different one is used.
-check_cache_fstype() {
- CACHEPATH=`awk -F: '{print $2}' < /etc/openafs/cacheinfo`
- FSTYPE=`stat -f -c '%T' "$CACHEPATH"`
- if [ x"$FSTYPE" != x"ext2/ext3" ] ; then
- echo ""
- echo "ERROR: AFS cache at $CACHEPATH is on a $FSTYPE file system" >&2
- echo "ERROR: Only ext2 or ext3 may be used for an AFS cache" >&2
- echo "Aborting startup of AFS" >&2
- exit 1
- fi
-}
-
# Start afsd. Be careful not to start it if another one is already running,
# as that has a bad tendency to hang the system.
start_client() {
echo "."
else
choose_afsd_options
- check_cache_fstype
echo " afsd."
start-stop-daemon --start --quiet --exec /usr/sbin/afsd \
-- $AFSD_OPTIONS
--- /dev/null
+Die rather than just warn if the AFS cache fails any of its sanity checks,
+diagnose use of tmpfs, and reject any file system type other than ext2 or
+ext3. Submitted upstream as #20947.
+
+--- openafs/src/afsd/afsd.c (revision 1849)
++++ openafs/src/afsd/afsd.c (local)
+@@ -1069,7 +1069,11 @@
+ return "cannot use reiserfs as cache partition";
+ } else if (statfsbuf.f_type == 0x58465342) { /* XFS_SUPER_MAGIC */
+ return "cannot use xfs as cache partition";
+- }
++ } else if (statfsbuf.f_type == 0x01021994) { /* TMPFS_SUPER_MAGIC */
++ return "cannot use tmpfs as cache partition";
++ } else if (statfsbuf.f_type != 0xEF53) {
++ return "must use ext2 or ext3 for cache partition";
++ }
+ }
+ #endif
+
+@@ -1665,8 +1669,10 @@
+ sprintf(fullpn_VFile, "%s/", cacheBaseDir);
+ vFilePtr = fullpn_VFile + strlen(fullpn_VFile);
+
+- if (!(cacheFlags & AFSCALL_INIT_MEMCACHE) && (fsTypeMsg = CheckCacheBaseDir(cacheBaseDir))) {
+- printf("%s: WARNING: Cache dir check failed (%s)\n", rn, fsTypeMsg);
++ if (!(cacheFlags & AFSCALL_INIT_MEMCACHE)
++ && (fsTypeMsg = CheckCacheBaseDir(cacheBaseDir))) {
++ printf("%s: ERROR: Cache dir check failed (%s)\n", rn, fsTypeMsg);
++ exit(1);
+ }
+ #if 0
+ fputs(AFS_GOVERNMENT_MESSAGE, stdout);
return "cannot use reiserfs as cache partition";
} else if (statfsbuf.f_type == 0x58465342) { /* XFS_SUPER_MAGIC */
return "cannot use xfs as cache partition";
- }
+ } else if (statfsbuf.f_type == 0x01021994) { /* TMPFS_SUPER_MAGIC */
+ return "cannot use tmpfs as cache partition";
+ } else if (statfsbuf.f_type != 0xEF53) {
+ return "must use ext2 or ext3 for cache partition";
+ }
}
#endif
sprintf(fullpn_VFile, "%s/", cacheBaseDir);
vFilePtr = fullpn_VFile + strlen(fullpn_VFile);
- if (!(cacheFlags & AFSCALL_INIT_MEMCACHE) && (fsTypeMsg = CheckCacheBaseDir(cacheBaseDir))) {
- printf("%s: WARNING: Cache dir check failed (%s)\n", rn, fsTypeMsg);
+ if (!(cacheFlags & AFSCALL_INIT_MEMCACHE)
+ && (fsTypeMsg = CheckCacheBaseDir(cacheBaseDir))) {
+ printf("%s: ERROR: Cache dir check failed (%s)\n", rn, fsTypeMsg);
+ exit(1);
}
#if 0
fputs(AFS_GOVERNMENT_MESSAGE, stdout);