aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus/dir.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@tuxera.com>2010-10-14 09:54:39 -0400
committerChristoph Hellwig <hch@lst.de>2010-10-14 09:54:39 -0400
commit90e616905a423126805186cb5754e10a704b30c8 (patch)
treef3b142b0414462ae9f267689c965d91c784760d4 /fs/hfsplus/dir.c
parent722c55d13e7296cc62ed8a38f926a915ff32e4ea (diff)
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 <hch@tuxera.com>
Diffstat (limited to 'fs/hfsplus/dir.c')
-rw-r--r--fs/hfsplus/dir.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index c05c8776e836..d236d85ec9d7 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,
418 if (!inode) 418 if (!inode)
419 goto out; 419 goto out;
420 420
421 if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode))
422 init_special_inode(inode, mode, rdev);
423
421 res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode); 424 res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode);
422 if (res) { 425 if (res) {
423 inode->i_nlink = 0; 426 inode->i_nlink = 0;
@@ -426,9 +429,6 @@ static int hfsplus_mknod(struct inode *dir, struct dentry *dentry,
426 goto out; 429 goto out;
427 } 430 }
428 431
429 if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode))
430 init_special_inode(inode, mode, rdev);
431
432 hfsplus_instantiate(dentry, inode, inode->i_ino); 432 hfsplus_instantiate(dentry, inode, inode->i_ino);
433 mark_inode_dirty(inode); 433 mark_inode_dirty(inode);
434out: 434out: