]> git.hungrycats.org Git - linux/commitdiff
[PATCH] hfsplus: symlink initialization fix
authorRoman Zippel <zippel@linux-m68k.org>
Sat, 6 Mar 2004 01:40:18 +0000 (17:40 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 6 Mar 2004 01:40:18 +0000 (17:40 -0800)
This fixes a problem with creating symlinks, a few fields in the
inode/dentry were left uninitialized.

fs/hfsplus/dir.c
fs/hfsplus/inode.c

index bcdd9521b59041cea9702a8c107a4f788d9735d2..656b5a2a4b802d5665a951991a0cc57b8231715b 100644 (file)
@@ -399,6 +399,7 @@ int hfsplus_symlink(struct inode *dir, struct dentry *dentry, const char *symnam
        res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode);
 
        if (!res) {
+               dentry->d_fsdata = (void *)inode->i_ino;
                d_instantiate(dentry, inode);
                mark_inode_dirty(inode);
        }
@@ -424,6 +425,7 @@ int hfsplus_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev
                return res;
        }
        init_special_inode(inode, mode, rdev);
+       dentry->d_fsdata = (void *)inode->i_ino;
        d_instantiate(dentry, inode);
        mark_inode_dirty(inode);
 
index 435e7e4bff8e4371259a26d1702cc29846d6de73..d810c52ea2af8d80a9ccbe503b002018cbc0ff45 100644 (file)
@@ -335,6 +335,14 @@ struct inode *hfsplus_new_inode(struct super_block *sb, int mode)
        init_MUTEX(&HFSPLUS_I(inode).extents_lock);
        atomic_set(&HFSPLUS_I(inode).opencnt, 0);
        HFSPLUS_I(inode).flags = 0;
+       memset(HFSPLUS_I(inode).first_extents, 0, sizeof(hfsplus_extent_rec));
+       memset(HFSPLUS_I(inode).cached_extents, 0, sizeof(hfsplus_extent_rec));
+       HFSPLUS_I(inode).alloc_blocks = 0;
+       HFSPLUS_I(inode).first_blocks = 0;
+       HFSPLUS_I(inode).cached_start = 0;
+       HFSPLUS_I(inode).cached_blocks = 0;
+       HFSPLUS_I(inode).phys_size = 0;
+       HFSPLUS_I(inode).rsrc_inode = 0;
        if (S_ISDIR(inode->i_mode)) {
                inode->i_size = 2;
                HFSPLUS_SB(sb).folder_count++;
@@ -346,14 +354,6 @@ struct inode *hfsplus_new_inode(struct super_block *sb, int mode)
                inode->i_fop = &hfsplus_file_operations;
                inode->i_mapping->a_ops = &hfsplus_aops;
                HFSPLUS_I(inode).clump_blocks = HFSPLUS_SB(sb).data_clump_blocks;
-               memset(HFSPLUS_I(inode).first_extents, 0, sizeof(hfsplus_extent_rec));
-               memset(HFSPLUS_I(inode).cached_extents, 0, sizeof(hfsplus_extent_rec));
-               HFSPLUS_I(inode).alloc_blocks = 0;
-               HFSPLUS_I(inode).first_blocks = 0;
-               HFSPLUS_I(inode).cached_start = 0;
-               HFSPLUS_I(inode).cached_blocks = 0;
-               HFSPLUS_I(inode).phys_size = 0;
-               HFSPLUS_I(inode).rsrc_inode = 0;
        } else if (S_ISLNK(inode->i_mode)) {
                HFSPLUS_SB(sb).file_count++;
                inode->i_op = &page_symlink_inode_operations;