]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
* Remove the init script check of the cache file system and instead
authorRuss Allbery <rra@debian.org>
Fri, 9 Sep 2005 09:29:23 +0000 (09:29 +0000)
committerRuss Allbery <rra@debian.org>
Fri, 9 Sep 2005 09:29:23 +0000 (09:29 +0000)
    improve the check in afsd.  The init script check used stat, which is
    in /usr/bin and therefore not fair game for init scripts.

debian/changelog
debian/openafs-client.init
debian/patches/cache-checks [new file with mode: 0644]
src/afsd/afsd.c

index 3105b3c60dad39289ae5ab37727adddc75420bcc..e0102d681ff836dd4c7a6d518b80889f78299de4 100644 (file)
@@ -4,6 +4,9 @@ openafs (1.4rc3-1) unstable; urgency=low
   * 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.
 
index d77afc2261055fb937390014151c208e4fde4c95..6461c82394cd40cf0300d8d4effa21f3729700b3 100755 (executable)
@@ -121,21 +121,6 @@ choose_afsd_options() {
     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() {
@@ -143,7 +128,6 @@ start_client() {
         echo "."
     else
         choose_afsd_options
-        check_cache_fstype
         echo " afsd."
         start-stop-daemon --start --quiet --exec /usr/sbin/afsd \
             -- $AFSD_OPTIONS
diff --git a/debian/patches/cache-checks b/debian/patches/cache-checks
new file mode 100644 (file)
index 0000000..6360217
--- /dev/null
@@ -0,0 +1,32 @@
+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);
index 05b3032b8514802b8983594a96224a5e356d1a5f..30ff42f6c4b046138e50951a98a6d0b26f8fa8e9 100644 (file)
@@ -1069,7 +1069,11 @@ CheckCacheBaseDir(char *dir)
            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 @@ mainproc(as, arock)
     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);