Commit 543481c9 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] hfsplus: correct dentry initialization for dir dentries.

From: Roman Zippel <zippel@linux-m68k.org>

Initialize d_fsdata field also for dir dentries, use hfsplus_instantiate
helper function for this.
parent 9a57bb39
......@@ -18,6 +18,13 @@
#include "hfsplus_fs.h"
#include "hfsplus_raw.h"
static inline void hfsplus_instantiate(struct dentry *dentry,
struct inode *inode, u32 cnid)
{
dentry->d_fsdata = (void *)(unsigned long)cnid;
d_instantiate(dentry, inode);
}
/* Find the entry inside dir named dentry->d_name */
static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
struct nameidata *nd)
......@@ -52,6 +59,7 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
goto fail;
}
cnid = be32_to_cpu(entry.folder.id);
dentry->d_fsdata = (void *)(unsigned long)cnid;
} else if (type == HFSPLUS_FILE) {
if (fd.entrylength < sizeof(struct hfsplus_cat_file)) {
err = -EIO;
......@@ -236,8 +244,7 @@ int hfsplus_create(struct inode *dir, struct dentry *dentry, int mode,
iput(inode);
return res;
}
dentry->d_fsdata = (void *)inode->i_ino;
d_instantiate(dentry, inode);
hfsplus_instantiate(dentry, inode, inode->i_ino);
mark_inode_dirty(inode);
return 0;
}
......@@ -284,8 +291,7 @@ int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir, struct dentry
return res;
inode->i_nlink++;
dst_dentry->d_fsdata = (void *)(unsigned long)cnid;
d_instantiate(dst_dentry, inode);
hfsplus_instantiate(dst_dentry, inode, cnid);
atomic_inc(&inode->i_count);
inode->i_ctime = CURRENT_TIME;
mark_inode_dirty(inode);
......@@ -354,7 +360,7 @@ int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, int mode)
iput(inode);
return res;
}
d_instantiate(dentry, inode);
hfsplus_instantiate(dentry, inode, inode->i_ino);
mark_inode_dirty(inode);
return 0;
}
......@@ -399,8 +405,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);
hfsplus_instantiate(dentry, inode, inode->i_ino);
mark_inode_dirty(inode);
}
......@@ -425,8 +430,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);
hfsplus_instantiate(dentry, inode, inode->i_ino);
mark_inode_dirty(inode);
return 0;
......
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