]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Unix: Modify disk cache versioning
authorSimon Wilkinson <sxw@your-file-system.com>
Thu, 22 Apr 2010 21:24:11 +0000 (22:24 +0100)
committerDerrick Brashear <shadow@dementia.org>
Fri, 23 Apr 2010 12:50:18 +0000 (05:50 -0700)
This change increments the disk cache version number, and adds a
structure size record to the disk cache header. All old disk caches
will be replaced when the client is started.

With the various changes made to unify our file handles, and to
support large file handles on Linux, the size of the 'fcache'
structure was modified earlier in the 1.5 series. However, fcache
is also the building block of the CacheItems file, so these changes
inadvertently broke users upgrading from 1.4. In addition, as the
disk cache inode is now a union of many different structures, the
structure size is now potentially volatile across both kernel, and
OpenAFS revisions.

Up the version number so old disk caches are invalidated and won't
crash users who are upgrading. Also take the opportunity to add an
item to the header which stores the size of struct fcache used
by the disk cache. If the size on disk doesn't match that expected
by the kernel module, truncate the cache and start again.

Change-Id: I2ee8863d0bfaaaba34272c9e139638e17669a53e
Reviewed-on: http://gerrit.openafs.org/1811
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/afs/afs.h
src/afs/afs_dcache.c
src/afs/afs_init.c

index 2a43b9e032ca25973f5e667f5cb5bb94524df0be..5ff445e097163cb2474212967d21af22b5d55269 100644 (file)
@@ -1052,12 +1052,9 @@ struct afs_ioctl32 {
 struct afs_fheader {
 #define AFS_FHMAGIC        0x7635abaf  /* uses version number */
     afs_int32 magic;
-#if defined(AFS_SUN57_64BIT_ENV)
-#define AFS_CI_VERSION 3
-#else
-#define AFS_CI_VERSION 2
-#endif
+#define AFS_CI_VERSION 4
     afs_int32 version;
+    afs_uint32 dataSize;
     afs_int32 firstCSize;
     afs_int32 otherCSize;
 };
index 03c83751708db57ac2c02d50a1f397e61a4d93e5..9d2bf48d510538b70d1da57ce0ad7846a319088e 100644 (file)
@@ -2551,6 +2551,7 @@ afs_WriteThroughDSlots(void)
        theader.firstCSize = AFS_FIRSTCSIZE;
        theader.otherCSize = AFS_OTHERCSIZE;
        theader.version = AFS_CI_VERSION;
+       theader.dataSize = sizeof(struct fcache);
        afs_osi_Write(afs_cacheInodep, 0, &theader, sizeof(theader));
     }
     ReleaseWriteLock(&afs_xdcache);
index 70394333dc9ce1ed163f8fd6239b3f1d86404857..90f967a6332a5c352817545c86acfe9ba9c64453 100644 (file)
@@ -488,6 +488,7 @@ afs_InitCacheInfo(register char *afile)
        if (theader.magic == AFS_FHMAGIC
            && theader.firstCSize == AFS_FIRSTCSIZE
            && theader.otherCSize == AFS_OTHERCSIZE
+           && theader.dataSize == sizeof(struct fcache)
            && theader.version == AFS_CI_VERSION)
            goodFile = 1;
     }
@@ -496,6 +497,7 @@ afs_InitCacheInfo(register char *afile)
        theader.magic = AFS_FHMAGIC;
        theader.firstCSize = AFS_FIRSTCSIZE;
        theader.otherCSize = AFS_OTHERCSIZE;
+       theader.dataSize = sizeof(struct fcache);
        theader.version = AFS_CI_VERSION;
        afs_osi_Write(tfile, 0, &theader, sizeof(theader));
        /*