From 90e616905a423126805186cb5754e10a704b30c8 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 14 Oct 2010 09:54:39 -0400 Subject: hfsplus: create correct initial catalog entries for device files Make sure the initial insertation of the catalog entry already contains the device number by calling init_special_inode early and setting writing out the dev field of the on-disk permission structure. The latter is facilitated by sharing the almost identical hfsplus_set_perms helpers between initial catalog entry creating and ->write_inode. Unless we crashed just after mknod this bug was harmless as the inode is marked dirty at the end of hfsplus_mknod, and hfsplus_write_inode will update the catalog entry to contain the correct value. Signed-off-by: Christoph Hellwig --- fs/hfsplus/dir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fs/hfsplus/dir.c') diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index c05c877..d236d85 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c @@ -418,6 +418,9 @@ static int hfsplus_mknod(struct inode *dir, struct dentry *dentry, if (!inode) goto out; + if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) + init_special_inode(inode, mode, rdev); + res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode); if (res) { inode->i_nlink = 0; @@ -426,9 +429,6 @@ static int hfsplus_mknod(struct inode *dir, struct dentry *dentry, goto out; } - if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) - init_special_inode(inode, mode, rdev); - hfsplus_instantiate(dentry, inode, inode->i_ino); mark_inode_dirty(inode); out: -- cgit v1.1