Fixes bug in KFS new inode creation
authorBarret Rhoden <brho@cs.berkeley.edu>
Sun, 4 Aug 2013 19:22:50 +0000 (12:22 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Sun, 4 Aug 2013 19:22:50 +0000 (12:22 -0700)
Wasn't properly initializing the size field.  This would only matter
when creating new files in KFS, and would only trigger if the memory we
alloc'd wasn't already zeroed.

Something like      $ echo "" >> tmpfile    was enough to cause it, once
the bits lined up right.

The previous commit's backtrace was rather useful in determining this
(without it, all we know is there was a KPF in memcpy).

kern/src/kfs.c

index 2373d0a..47941f0 100644 (file)
@@ -173,6 +173,7 @@ struct inode *kfs_alloc_inode(struct super_block *sb)
        inode->i_fs_info = kmem_cache_alloc(kfs_i_kcache, 0);
        TAILQ_INIT(&((struct kfs_i_info*)inode->i_fs_info)->children);
        ((struct kfs_i_info*)inode->i_fs_info)->filestart = 0;
+       ((struct kfs_i_info*)inode->i_fs_info)->init_size = 0;
        return inode;
 }