From 8b141efe96d0080b90a1331b080e9250771aff17 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Fri, 22 Nov 2002 20:07:27 +0000 Subject: [PATCH] cachemgr-warn-solaris-users-of-dangers-of-logging-20021122 with feedback from others. --- src/afsd/afsd.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index f5a2c8a..e6b2a09 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c @@ -1484,6 +1484,37 @@ mainproc(as, arock) sprintf(fullpn_VFile, "%s/", cacheBaseDir); vFilePtr = fullpn_VFile + strlen(fullpn_VFile); +#ifdef AFS_SUN5_ENV + { + FILE *vfstab; + struct mnttab mnt; + struct stat statmnt, statci; + + if ((stat(cacheBaseDir, &statci) == 0) && + ((vfstab = fopen(MNTTAB, "r")) != NULL)) { + while (getmntent(vfstab, &mnt) == 0) { + if (strcmp(cacheBaseDir, mnt.mnt_mountp) != 0) { + char *cp; + int rdev = 0; + + if (cp = hasmntopt(&mnt, "dev=")) + rdev=(int)strtol(cp+strlen("dev="), (char **)NULL, 16); + + if ((rdev == 0) && (stat(mnt.mnt_mountp, &statmnt) == 0)) + rdev=statmnt.st_dev; + + if ((rdev == statci.st_dev) && + (hasmntopt (&mnt, "logging") != NULL)) { + printf("WARNING: Mounting a multi-use partition which contains the AFS cache with the\n\"logging\" option may deadlock your system.\n\n"); + fflush(stdout); + } + } + } + fclose(vfstab); + } + } +#endif + #if 0 fputs(AFS_GOVERNMENT_MESSAGE, stdout); fflush(stdout); -- 1.9.4