Commit ff9fc790 authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

[PATCH] hfsplus: symlink initialization fix

This fixes a problem with creating symlinks, a few fields in the
inode/dentry were left uninitialized.
parent 439f0cc9
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment