LINUX: old kernel warning fixes
[openafs.git] / src / afs / LINUX / osi_vfsops.c
index d193958..5647897 100644 (file)
  *
  * super_block operations should return negated errno to Linux.
  */
-#include "../afs/param.h"
-#include "../afs/sysincludes.h"
-#include "../afs/afsincludes.h"
-#include "../afs/afs_stats.h"
-#include "../h/locks.h"
-#if defined(AFS_LINUX24_ENV)
-#include "../h/smp_lock.h"
-#endif
+#include <afsconfig.h>
+#include "afs/param.h"
+
 
-#define __NO_VERSION__ /* don't define kernel_verion in module.h */
-#include <linux/module.h>
+#define __NO_VERSION__         /* don't define kernel_version in module.h */
+#include <linux/module.h> /* early to avoid printf->printk mapping */
+#include "afs/sysincludes.h"
+#include "afsincludes.h"
+#include "afs/afs_stats.h"
+#include <linux/smp_lock.h>
 
+#include "osi_compat.h"
 
 struct vcache *afs_globalVp = 0;
 struct vfs *afs_globalVFS = 0;
-int afs_was_mounted = 0; /* Used to force reload if mount/unmount/mount */
+struct vfsmount *afs_cacheMnt;
+int afs_was_mounted = 0;       /* Used to force reload if mount/unmount/mount */
 
 extern struct super_operations afs_sops;
+#if !defined(AFS_NONFSTRANS)
+extern struct export_operations afs_export_ops;
+#endif
 extern afs_rwlock_t afs_xvcache;
 extern struct afs_q VLRU;
 
@@ -37,11 +41,9 @@ extern struct dentry_operations afs_dentry_operations;
 
 /* Forward declarations */
 static void iattr2vattr(struct vattr *vattrp, struct iattr *iattrp);
-static void update_inode_cache(struct inode *ip, struct vattr *vp);
 static int afs_root(struct super_block *afsp);
-struct super_block *afs_read_super(struct super_block *sb, void *data,
-                                  int silent);
-void put_inode_on_dummy_list(struct inode *ip);
+struct super_block *afs_read_super(struct super_block *sb, void *data, int silent);
+int afs_fill_super(struct super_block *sb, void *data, int silent);
 
 /* afs_file_system
  * VFS entry for Linux - installed in init_module
@@ -50,94 +52,133 @@ void put_inode_on_dummy_list(struct inode *ip);
  * 2) Mount call comes to us via do_mount -> read_super -> afs_read_super.
  *    We are expected to setup the super_block. See afs_read_super.
  */
-#if defined(AFS_LINUX24_ENV)
-DECLARE_FSTYPE(afs_file_system, "afs", afs_read_super, 0);
-#else
-struct file_system_type afs_file_system = {
-    "afs",     /* name - used by mount operation. */
-    0,         /* requires_dev - no for network filesystems. mount() will 
-                * pass us an "unnamed" device. */
-    afs_read_super, /* wrapper to afs_mount */
-    NULL       /* pointer to next file_system_type once registered. */
-};
-#endif
+
 
 /* afs_read_super
  * read the "super block" for AFS - roughly eguivalent to struct vfs.
  * dev, covered, s_rd_only, s_dirt, and s_type will be set by read_super.
  */
-struct super_block *afs_read_super(struct super_block *sb, void *data,
-                                  int silent)
+#ifdef GET_SB_HAS_STRUCT_VFSMOUNT
+static int
+afs_get_sb(struct file_system_type *fs_type, int flags,
+          const char *dev_name, void *data, struct vfsmount *mnt) {
+    return get_sb_nodev(fs_type, flags, data, afs_fill_super, mnt);
+}
+#else
+static struct super_block *
+afs_get_sb(struct file_system_type *fs_type, int flags,
+          const char *dev_name, void *data) {
+    return get_sb_nodev(fs_type, flags, data, afs_fill_super);
+}
+#endif
+
+struct file_system_type afs_fs_type = {
+    .owner = THIS_MODULE,
+    .name = "afs",
+    .get_sb = afs_get_sb,
+    .kill_sb = kill_anon_super,
+    .fs_flags = FS_BINARY_MOUNTDATA,
+};
+
+struct backing_dev_info *afs_backing_dev_info;
+
+int
+afs_fill_super(struct super_block *sb, void *data, int silent)
 {
     int code = 0;
 
     AFS_GLOCK();
     if (afs_was_mounted) {
-       printf("You must reload the AFS kernel extensions before remounting AFS.\n");
-       return NULL;
+       printf
+           ("You must reload the AFS kernel extensions before remounting AFS.\n");
+       AFS_GUNLOCK();
+       return -EINVAL;
     }
     afs_was_mounted = 1;
 
     /* Set basics of super_block */
-#if !defined(AFS_LINUX24_ENV)
-    lock_super(sb);
-#endif
-    MOD_INC_USE_COUNT;
+   __module_get(THIS_MODULE);
 
     afs_globalVFS = sb;
+    sb->s_flags |= MS_NOATIME;
     sb->s_blocksize = 1024;
     sb->s_blocksize_bits = 10;
     sb->s_magic = AFS_VFSMAGIC;
     sb->s_op = &afs_sops;      /* Super block (vfs) ops */
-    code = afs_root(sb);
-    if (code)
-       MOD_DEC_USE_COUNT;
-
-#if !defined(AFS_LINUX24_ENV)
-    unlock_super(sb);
+    /* used for inodes backing_dev_info field, also */
+    afs_backing_dev_info = osi_Alloc(sizeof(struct backing_dev_info));
+#if defined(HAVE_LINUX_BDI_INIT)
+    bdi_init(afs_backing_dev_info);
+#endif
+#if defined(STRUCT_BACKING_DEV_INFO_HAS_NAME)
+    afs_backing_dev_info->name = "openafs";
+#endif
+    afs_backing_dev_info->ra_pages = 32;
+#if defined (STRUCT_SUPER_BLOCK_HAS_S_BDI)
+    sb->s_bdi = afs_backing_dev_info;
+    /* The name specified here will appear in the flushing thread name - flush-afs */
+    bdi_register(afs_backing_dev_info, NULL, "afs");
+#endif
+#if !defined(AFS_NONFSTRANS)
+    sb->s_export_op = &afs_export_ops;
+#endif
+#if defined(MAX_NON_LFS)
+#ifdef AFS_64BIT_CLIENT
+#if !defined(MAX_LFS_FILESIZE)
+#if BITS_PER_LONG==32
+#define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) 
+#elif BITS_PER_LONG==64
+#define MAX_LFS_FILESIZE 0x7fffffffffffffff
+#endif
 #endif
+    sb->s_maxbytes = MAX_LFS_FILESIZE;
+#else
+    sb->s_maxbytes = MAX_NON_LFS;
+#endif
+#endif
+    code = afs_root(sb);
+    if (code) {
+       afs_globalVFS = NULL;
+       osi_linux_free_inode_pages();
+        module_put(THIS_MODULE);
+    }
 
     AFS_GUNLOCK();
-    return code ? NULL : sb;
+    return code ? -EINVAL : 0;
 }
 
 
 /* afs_root - stat the root of the file system. AFS global held on entry. */
-static int afs_root(struct super_block *afsp)
+static int
+afs_root(struct super_block *afsp)
 {
-    register afs_int32 code = 0;
+    afs_int32 code = 0;
     struct vrequest treq;
-    register struct vcache *tvp=0;
+    struct vcache *tvp = 0;
 
     AFS_STATCNT(afs_root);
-    if (afs_globalVp && (afs_globalVp->states & CStatd)) {
+    if (afs_globalVp && (afs_globalVp->f.states & CStatd)) {
        tvp = afs_globalVp;
     } else {
        cred_t *credp = crref();
-       afs_globalVp = 0;
-       if (!(code = afs_InitReq(&treq, credp)) &&
-           !(code = afs_CheckInit())) {
-           tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
-                               (struct vcache*)0, WRITE_LOCK);
+
+       if (afs_globalVp) {
+           afs_PutVCache(afs_globalVp);
+           afs_globalVp = NULL;
+       }
+
+       if (!(code = afs_InitReq(&treq, credp)) && !(code = afs_CheckInit())) {
+           tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
            if (tvp) {
-               extern struct inode_operations afs_dir_iops;
-#if defined(AFS_LINUX24_ENV)
-               extern struct file_operations afs_dir_fops;
-#endif
-               
-               /* "/afs" is a directory, reset inode ops accordingly. */
-               tvp->v.v_op = &afs_dir_iops;
-#if defined(AFS_LINUX24_ENV)
-               tvp->v.v_fop = &afs_dir_fops;
-#endif
+               struct inode *ip = AFSTOV(tvp);
+               struct vattr vattr;
+
+               afs_getattr(tvp, &vattr, credp);
+               afs_fill_inode(ip, &vattr);
 
                /* setup super_block and mount point inode. */
                afs_globalVp = tvp;
-#if defined(AFS_LINUX24_ENV)
-               afsp->s_root = d_alloc_root((struct inode*)tvp);
-#else
-               afsp->s_root = d_alloc_root((struct inode*)tvp, NULL);
-#endif
+               afsp->s_root = d_alloc_root(ip);
                afsp->s_root->d_op = &afs_dentry_operations;
            } else
                code = ENOENT;
@@ -152,227 +193,213 @@ static int afs_root(struct super_block *afsp)
 
 /* super_operations */
 
-/* afs_read_inode
- * called via iget to read in the inode. The passed in inode has i_ino, i_dev
- * and i_sb setup on input. Linux file systems use this to get super block
- * inode information, so we don't really care what happens here.
- * For Linux 2.2, we'll be called if we participate in the inode pool.
- */
-void afs_read_inode(struct inode *ip)
-{
-    /* I don't think we ever get called with this. So print if we do. */
-    printf("afs_read_inode: Called for inode %d\n", ip->i_ino);
-}
-
-
 /* afs_notify_change
  * Linux version of setattr call. What to change is in the iattr struct.
  * We need to set bits in both the Linux inode as well as the vcache.
  */
-int afs_notify_change(struct dentry *dp, struct iattr* iattrp)
+int
+afs_notify_change(struct dentry *dp, struct iattr *iattrp)
 {
     struct vattr vattr;
-    int code;
     cred_t *credp = crref();
     struct inode *ip = dp->d_inode;
+    int code;
 
-    AFS_GLOCK();
     VATTR_NULL(&vattr);
-    iattr2vattr(&vattr, iattrp); /* Convert for AFS vnodeops call. */
-    update_inode_cache(ip, &vattr);
-    code = afs_setattr((struct vcache*)ip, &vattr, credp);
-    afs_CopyOutAttrs((struct vcache*)ip, &vattr);
-    /* Note that the inode may still not have all the correct info. But at
-     * least we've got the newest version of what was supposed to be set.
-     */
+    iattr2vattr(&vattr, iattrp);       /* Convert for AFS vnodeops call. */
 
+    AFS_GLOCK();
+    code = afs_setattr(VTOAFS(ip), &vattr, credp);
+    if (!code) {
+       afs_getattr(VTOAFS(ip), &vattr, credp);
+       vattr2inode(ip, &vattr);
+    }
     AFS_GUNLOCK();
     crfree(credp);
     return -code;
 }
 
 
-/* This list is simply used to initialize the i_list member of the
- * linux inode. This stops linux inode syncing code from choking on our
- * inodes.
- */
-static LIST_HEAD(dummy_inode_list);
-
+#if defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE)
+static afs_kmem_cache_t *afs_inode_cachep;
 
-/* This is included for documentation only. */
-/* afs_write_inode
- * Used to flush in core inode to disk. We don't need to do this. Top level
- * write_inode() routine will clear i_dirt. If this routine is in the table,
- * it's expected to do the cleaning and clear i_dirt.
- * 
- * 9/24/99: This is what we thought until we discovered msync() does end up calling
- * this function to sync a single inode to disk. msync() only flushes selective
- * pages to disk. So it needs an inode syncing function to update metadata when it
- * has synced some pages of a file to disk.
- */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-void afs_write_inode(struct inode *ip, int unused) 
-#else
-void afs_write_inode(struct inode *ip) 
-#endif
+static struct inode *
+afs_alloc_inode(struct super_block *sb)
 {
-    /* and put it back on our dummy list. */
-    list_del(&ip->i_list);
-    list_add(&ip->i_list, &dummy_inode_list);
+    struct vcache *vcp;
+
+    vcp = (struct vcache *) kmem_cache_alloc(afs_inode_cachep, KALLOC_TYPE);
+    if (!vcp)
+       return NULL;
 
-    /* for now we don't actually update the metadata during msync. This
-     * is just to keep linux happy.  */
+    return AFSTOV(vcp);
 }
 
+static void
+afs_destroy_inode(struct inode *inode)
+{
+    kmem_cache_free(afs_inode_cachep, inode);
+}
 
-/* afs_put_inode
- * called from iput when count goes to zero. Linux version of inactive.
- * For Linux 2.2, this funcionality has moved to the delete inode super op.
- * If we use the common inode pool, we'll need to set i_nlink to 0 here.
- * That will trigger the call to delete routine.
- */
-void afs_delete_inode(struct inode *ip)
+void
+init_once(void * foo)
 {
-    cred_t *credp = crref();
-    struct vcache *vc = (struct vcache*)ip;
+    struct vcache *vcp = (struct vcache *) foo;
 
-    AFS_GLOCK();
-#if defined(AFS_LINUX24_ENV)
-    lock_kernel();
-    if (atomic_read(&ip->i_count) > 1)
+    inode_init_once(AFSTOV(vcp));
+}
+
+int
+afs_init_inodecache(void)
+{
+#if defined(KMEM_CACHE_TAKES_DTOR)
+    afs_inode_cachep = kmem_cache_create("afs_inode_cache",
+               sizeof(struct vcache), 0,
+               SLAB_HWCACHE_ALIGN | SLAB_RECLAIM_ACCOUNT, init_once_func, NULL);
 #else
-    if (ip->i_count > 1)
+    afs_inode_cachep = kmem_cache_create("afs_inode_cache",
+               sizeof(struct vcache), 0,
+               SLAB_HWCACHE_ALIGN | SLAB_RECLAIM_ACCOUNT, init_once_func);
 #endif
-       printf("afs_put_inode: ino %d (0x%x) has count %d\n", ip->i_ino, ip);
+    if (afs_inode_cachep == NULL)
+       return -ENOMEM;
+    return 0;
+}
 
-    ObtainWriteLock(&vc->lock, 504);
-    afs_InactiveVCache(vc, credp);
-#if defined(AFS_LINUX24_ENV)
-    atomic_set(&ip->i_count, 0);
+void
+afs_destroy_inodecache(void)
+{
+    if (afs_inode_cachep)
+       (void) kmem_cache_destroy(afs_inode_cachep);
+}
 #else
-    ip->i_count = 0;
+int
+afs_init_inodecache(void)
+{
+    return 0;
+}
+
+void
+afs_destroy_inodecache(void)
+{
+    return;
+}
 #endif
-    ip->i_nlink = 0; /* iput checks this after calling this routine. */
-    ReleaseWriteLock(&vc->lock);
 
-#ifdef AFS_LINUX24_ENV
-    unlock_kernel();
+#if defined(STRUCT_SUPER_OPERATIONS_HAS_EVICT_INODE)
+static void
+afs_evict_inode(struct inode *ip)
+{
+    struct vcache *vcp = VTOAFS(ip);
+
+    if (vcp->vlruq.prev || vcp->vlruq.next)
+       osi_Panic("inode freed while on LRU");
+    if (vcp->hnext)
+       osi_Panic("inode freed while still hashed");
+
+    truncate_inode_pages(&ip->i_data, 0);
+    end_writeback(ip);
+
+#if !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE)
+    afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache));
+#endif
+}
+#else
+static void
+afs_clear_inode(struct inode *ip)
+{
+    struct vcache *vcp = VTOAFS(ip);
+
+    if (vcp->vlruq.prev || vcp->vlruq.next)
+       osi_Panic("inode freed while on LRU");
+    if (vcp->hnext)
+       osi_Panic("inode freed while still hashed");
+
+#if !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE)
+    afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache));
 #endif
-    AFS_GUNLOCK();
-    crfree(credp);
 }
+#endif
 
 /* afs_put_super
  * Called from unmount to release super_block. */
-void afs_put_super(struct super_block *sbp)
+static void
+afs_put_super(struct super_block *sbp)
 {
-    extern int afs_afs_cold_shutdown;
-    int code = 0;
-    int fv_slept;
-
     AFS_GLOCK();
     AFS_STATCNT(afs_unmount);
 
-    if (!suser())
-       return;
-
     afs_globalVFS = 0;
     afs_globalVp = 0;
+
+    osi_linux_free_inode_pages();      /* invalidate and release remaining AFS inodes. */
     afs_shutdown();
+    mntput(afs_cacheMnt);
 
     osi_linux_verify_alloced_memory();
- done:
+#if defined(HAVE_LINUX_BDI_INIT)
+    bdi_destroy(afs_backing_dev_info);
+#endif
+    osi_Free(afs_backing_dev_info, sizeof(struct backing_dev_info));
     AFS_GUNLOCK();
 
-    if (!code) {
-       sbp->s_dev = 0;
-       MOD_DEC_USE_COUNT;
-    }
-}
-
-#ifdef NOTUSED
-/* afs_write_super
- * Not required since we don't write out a super block. */
-void afs_write_super(struct super_block *sbp)
-{
+    sbp->s_dev = 0;
+    module_put(THIS_MODULE);
 }
 
-/* afs_remount_fs
- * Used to remount filesystems with different flags. Not relevant for AFS.
- */
-int afs_remount_fs(struct super_block *sbp, int *, char *)
-{
-    return -EINVAL;
-}
-#endif
 
 /* afs_statfs
  * statp is in user space, so we need to cobble together a statfs, then
  * copy it.
  */
-#if defined(AFS_LINUX24_ENV)
-int afs_statfs(struct super_block *sbp, struct statfs *statp)
+int
+#if defined(STATFS_TAKES_DENTRY)
+afs_statfs(struct dentry *dentry, struct kstatfs *statp)
 #else
-int afs_statfs(struct super_block *sbp, struct statfs *statp, int size)
+afs_statfs(struct super_block *sbp, struct kstatfs *statp)
 #endif
 {
-    struct statfs stat;
+    memset(statp, 0, sizeof(*statp));
 
     AFS_STATCNT(afs_statfs);
 
-#if !defined(AFS_LINUX24_ENV)
-    if (size < sizeof(struct statfs))
-       return;
-       
-    memset(&stat, 0, size);
-#endif
-    stat.f_type = 0; /* Can we get a real type sometime? */
-    stat.f_bsize = sbp->s_blocksize;
-    stat.f_blocks =  stat.f_bfree =  stat.f_bavail =  stat.f_files =
-       stat.f_ffree = 9000000;
-    stat.f_fsid.val[0] = AFS_VFSMAGIC;
-    stat.f_fsid.val[1] = AFS_VFSFSID;
-    stat.f_namelen = 256;
-
-#if defined(AFS_LINUX24_ENV)
-    *statp = stat;
+    /* hardcode in case that which is giveth is taken away */
+    statp->f_type = 0x5346414F;
+#if defined(STATFS_TAKES_DENTRY)
+    statp->f_bsize = dentry->d_sb->s_blocksize;
 #else
-    memcpy_tofs(statp, &stat, size);
+    statp->f_bsize = sbp->s_blocksize;
 #endif
+    statp->f_blocks = statp->f_bfree = statp->f_bavail = statp->f_files =
+       statp->f_ffree = 9000000;
+    statp->f_fsid.val[0] = AFS_VFSMAGIC;
+    statp->f_fsid.val[1] = AFS_VFSFSID;
+    statp->f_namelen = 256;
+
     return 0;
 }
 
-
-#if defined(AFS_LINUX24_ENV)
 struct super_operations afs_sops = {
-    read_inode:        afs_read_inode,
-    write_inode:       afs_write_inode,
-    delete_inode:      afs_delete_inode,
-    put_super:         afs_put_super,
-    statfs:            afs_statfs,
-};
+#if defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE)
+  .alloc_inode =       afs_alloc_inode,
+  .destroy_inode =     afs_destroy_inode,
+#endif
+#if defined(STRUCT_SUPER_OPERATIONS_HAS_EVICT_INODE)
+  .evict_inode =       afs_evict_inode,
 #else
-struct super_operations afs_sops = {
-    afs_read_inode,
-    afs_write_inode,           /* afs_write_inode - see doc above. */
-    NULL,              /* afs_put_inode */
-    afs_delete_inode,
-    afs_notify_change,
-    afs_put_super,
-    NULL,              /* afs_write_super - see doc above */
-    afs_statfs,
-    NULL,              /* afs_remount_fs - see doc above */
-    NULL,              /* afs_clear_inode */
-    NULL,              /* afs_umount_begin */
-};
+  .clear_inode =       afs_clear_inode,
 #endif
+  .put_super =         afs_put_super,
+  .statfs =            afs_statfs,
+};
 
 /************** Support routines ************************/
 
 /* vattr_setattr
  * Set iattr data into vattr. Assume vattr cleared before call.
  */
-static void iattr2vattr(struct vattr *vattrp, struct iattr *iattrp)
+static void
+iattr2vattr(struct vattr *vattrp, struct iattr *iattrp)
 {
     vattrp->va_mask = iattrp->ia_valid;
     if (iattrp->ia_valid & ATTR_MODE)
@@ -384,83 +411,71 @@ static void iattr2vattr(struct vattr *vattrp, struct iattr *iattrp)
     if (iattrp->ia_valid & ATTR_SIZE)
        vattrp->va_size = iattrp->ia_size;
     if (iattrp->ia_valid & ATTR_ATIME) {
-       vattrp->va_atime.tv_sec = iattrp->ia_atime;
+       vattrp->va_atime.tv_sec = iattrp->ia_atime.tv_sec;
        vattrp->va_atime.tv_usec = 0;
     }
     if (iattrp->ia_valid & ATTR_MTIME) {
-       vattrp->va_mtime.tv_sec = iattrp->ia_mtime;
+       vattrp->va_mtime.tv_sec = iattrp->ia_mtime.tv_sec;
        vattrp->va_mtime.tv_usec = 0;
     }
     if (iattrp->ia_valid & ATTR_CTIME) {
-       vattrp->va_ctime.tv_sec = iattrp->ia_ctime;
+       vattrp->va_ctime.tv_sec = iattrp->ia_ctime.tv_sec;
        vattrp->va_ctime.tv_usec = 0;
     }
 }
 
-/* update_inode_cache
- * Update inode with info from vattr struct. Use va_mask to determine what
- * to update.
- */
-static void update_inode_cache(struct inode *ip, struct vattr *vp)
-{
-    if (vp->va_mask & ATTR_MODE)
-       ip->i_mode = vp->va_mode;
-    if (vp->va_mask & ATTR_UID)
-       ip->i_uid = vp->va_uid;
-    if (vp->va_mask & ATTR_GID)
-       ip->i_gid = vp->va_gid;
-    if (vp->va_mask & ATTR_SIZE)
-       ip->i_size = vp->va_size;
-    if (vp->va_mask & ATTR_ATIME)
-       ip->i_atime = vp->va_atime.tv_sec;
-    if (vp->va_mask & ATTR_MTIME)
-       ip->i_mtime = vp->va_mtime.tv_sec;
-    if (vp->va_mask & ATTR_CTIME)
-       ip->i_ctime = vp->va_ctime.tv_sec;
-}
-
 /* vattr2inode
  * Rewrite the inode cache from the attr. Assumes all vattr fields are valid.
  */
-void vattr2inode(struct inode *ip, struct vattr *vp)
+void
+vattr2inode(struct inode *ip, struct vattr *vp)
 {
     ip->i_ino = vp->va_nodeid;
     ip->i_nlink = vp->va_nlink;
     ip->i_blocks = vp->va_blocks;
+#ifdef STRUCT_INODE_HAS_I_BLKBITS
+    ip->i_blkbits = AFS_BLKBITS;
+#endif
+#ifdef STRUCT_INODE_HAS_I_BLKSIZE
     ip->i_blksize = vp->va_blocksize;
+#endif
     ip->i_rdev = vp->va_rdev;
     ip->i_mode = vp->va_mode;
     ip->i_uid = vp->va_uid;
     ip->i_gid = vp->va_gid;
-    ip->i_size = vp->va_size;
-    ip->i_atime = vp->va_atime.tv_sec;
-    ip->i_mtime = vp->va_mtime.tv_sec;
-    ip->i_ctime = vp->va_ctime.tv_sec;
-
-    /* we should put our inodes on a dummy inode list to keep linux happy.*/
-    if (!ip->i_list.prev && !ip->i_list.next) { 
-       /* this might be bad as we are reaching under the covers of the 
-        * list structure but we want to avoid putting the inode 
-        * on the list more than once.   */
-       put_inode_on_dummy_list(ip);
-    }
+    i_size_write(ip, vp->va_size);
+    ip->i_atime.tv_sec = vp->va_atime.tv_sec;
+    ip->i_atime.tv_nsec = 0;
+    ip->i_mtime.tv_sec = vp->va_mtime.tv_sec;
+    /* Set the mtime nanoseconds to the sysname generation number.
+     * This convinces NFS clients that all directories have changed
+     * any time the sysname list changes.
+     */
+    ip->i_mtime.tv_nsec = afs_sysnamegen;
+    ip->i_ctime.tv_sec = vp->va_ctime.tv_sec;
+    ip->i_ctime.tv_nsec = 0;
 }
 
-/* Put this afs inode on our own dummy list. Linux expects to see inodes
- * nicely strung up in lists. Linux inode syncing code chokes on our inodes if
- * they're not on any lists.
+/* osi_linux_free_inode_pages
+ *
+ * Free all vnodes remaining in the afs hash.  Must be done before
+ * shutting down afs and freeing all memory.
  */
-void put_inode_on_dummy_list(struct inode *ip)
+void
+osi_linux_free_inode_pages(void)
 {
-    /* Initialize list. See explanation above. */
-    list_add(&ip->i_list, &dummy_inode_list);
-}
-
-/* And yet another routine to update the inode cache - called from ProcessFS */
-void vcache2inode(struct vcache *avc)
-{
-    struct vattr vattr;
+    int i;
+    struct vcache *tvc, *nvc;
+    extern struct vcache *afs_vhashT[VCSIZE];
 
-    VATTR_NULL(&vattr);
-    afs_CopyOutAttrs(avc, &vattr); /* calls vattr2inode */
+    for (i = 0; i < VCSIZE; i++) {
+       for (tvc = afs_vhashT[i]; tvc; ) {
+           int slept;
+       
+           nvc = tvc->hnext;
+           if (afs_FlushVCache(tvc, &slept))           /* slept always 0 for linux? */
+               printf("Failed to invalidate all pages on inode 0x%p\n", tvc);
+           tvc = nvc;
+       }
+    }
 }