[OpenAFS-devel] 1.2.8 on HP-UX 11.00

Nathan Neulinger nneul@umr.edu
Thu, 17 Apr 2003 09:14:25 -0500


--+HP7ph2BbKc20aGI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

The attached diff would be a good starting point I think... Have not tested 
other than to make sure it compiles clean.

If someone wanted to try on the hpux 11 machine that had a vxfs cache, that'd 
be a good test. It should exit out of afsd and print an error.

Note - you probably will still have to reboot machine since it doesn't clean 
up the kernel - it just terminates, but it should at least avoid a panic
without a previous explanation as to what was wrong.

-- Nathan

On Thu, Apr 17, 2003 at 08:39:57AM -0500, Neulinger, Nathan wrote:
> I kindof wonder if we should hardcode that into afsd with a statfs call
> and a check against f_type, and at least generate an error message at
> startup instead of letting the kernel panic.
> 
> Not sure if it should be a check-for-known-bad or check-for-known-good
> type check though. The latter means that new filesystems aren't likely
> to be checked. Probably the former - checking specifically for things we
> know that DON'T work would be best.
> 
> -- Nathan
> 
> ------------------------------------------------------------
> Nathan Neulinger                       EMail:  nneul@umr.edu
> University of Missouri - Rolla         Phone: (573) 341-4841
> Computing Services                       Fax: (573) 341-4216
> 
> 
> > -----Original Message-----
> > From: Todd M. Lewis [mailto:utoddl@email.unc.edu] 
> > Sent: Thursday, April 17, 2003 8:32 AM
> > To: openafs-devel@openafs.org
> > Subject: Re: [OpenAFS-devel] 1.2.8 on HP-UX 11.00
> > 
> > 
> > 
> > 
> > Derrick J Brashear wrote:
> > > So it gets in the archive, the answer to this is "don't use VxFS for
> > > cache, use (I think it's) hfs. (The vendor's standard ufs 
> > filesystem)
> > > 
> > > This probably belongs in some documentation we don't have yet.
> > 
> > What about 
> > http://grand.central.org/twiki/bin/view/AFSLore/AdminFAQ#3_29_
> What_underlying_filesystems 
> and
> http://grand.central.org/twiki/bin/view/AFSLore/SupportedConfigurations,
> specifically the last line in the last table that says:
>     These Don't Work 	 reiserfs, vxfs (HP-UX)
> -- 
>      +-------------------------------------------------------------+
>     /Todd_Lewis@unc.edu  919-962-5273  http://www.unc.edu/~utoddl /
>    /   A picture is worth a thousand words, or in the case of    /
>   /     modern art, the same word repeated a thousand times.    /
> +-------------------------------------------------------------+
> 
> _______________________________________________
> OpenAFS-devel mailing list
> OpenAFS-devel@openafs.org
> https://lists.openafs.org/mailman/listinfo/openafs-devel
> _______________________________________________
> OpenAFS-devel mailing list
> OpenAFS-devel@openafs.org
> https://lists.openafs.org/mailman/listinfo/openafs-devel
-- Nathan

------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul@umr.edu
University of Missouri - Rolla         Phone: (573) 341-4841
Computing Services                       Fax: (573) 341-4216

--+HP7ph2BbKc20aGI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="afsd.checkcache.diff"

Index: afsd.c
===================================================================
RCS file: /cvs/openafs/src/afsd/afsd.c,v
retrieving revision 1.32
diff -u -r1.32 afsd.c
--- afsd.c	23 Mar 2003 19:43:49 -0000	1.32
+++ afsd.c	17 Apr 2003 14:07:30 -0000
@@ -984,11 +984,64 @@
     return(0);
 }
 
+char *CheckCacheBaseDir(char *dir)
+{
+	struct stat statbuf;
+
+	if ( !dir ) { return "cache base dir not specified"; }
+	if ( stat(dir, &statbuf) != 0 ) {
+		return "unable to stat cache base directory";
+	}
+
+	/* might want to check here for anything else goofy, like cache pointed at a non-dedicated directory, etc */
+
+#ifdef AFS_LINUX24_ENV
+	{
+		int res;
+		struct statfs statfsbuf;
+
+		res = statfs(dir, &statfsbuf);
+		if ( res != 0 ) {
+			return "unable to statfs cache base directory";
+		}
+		if ( statfsbuf.f_type == 0x52654973 ) /* REISERFS_SUPER_MAGIC */
+		{
+			return "cannot use reiserfs as cache partition";
+		}
+	}
+#endif
+
+#ifdef AFS_HPUX_ENV
+	{
+		int res;
+		struct statfs statfsbuf;
+		char name[FSTYPSZ];
+
+		res = statfs(dir, &statfsbuf);
+		if ( res != 0 )
+			return "unable to statfs cache base directory";
+		}
+
+		if (sysfs(GETFSTYP, statfsbuf.f_fsid, name) != 0 
+		{
+			return "unable to determine filesystem type for cache base dir";
+		}
+
+		if ( strcmp(name, "hfs") )
+		{
+			return "can only use hfs filesystem for cache partition on hpux";
+		}
+	}
+
+	return NULL;
+}
+
 int SweepAFSCache(vFilesFound)
     int *vFilesFound;
 {
     static char	rn[] = "SweepAFSCache";	/*Routine name*/
     int maxDir = (cacheFiles + nFilesPerDir - 1 ) / nFilesPerDir;
+    char *fsTypeMsg = NULL;
     int i;
 
     *vFilesFound = 0;
@@ -997,6 +1050,11 @@
 	if (afsd_debug)
 	    printf("%s: Memory Cache, no cache sweep done\n", rn);
 	return 0;
+    }
+
+    if ((fsTypeMsg = CheckCacheBaseDir(cacheBaseDir))) {
+        printf("%s: Cache dir check failed (%s)\n", rn, fsTypeMsg);
+	return (-1);
     }
 
     if (cache_dir_list == NULL) {

--+HP7ph2BbKc20aGI--