fat: make sure to set d_ops in fat_get_parent
[pandora-kernel.git] / fs / fat / inode.c
index 9e37ad9..37a8af1 100644 (file)
@@ -542,6 +542,20 @@ static int fat_statfs(struct dentry *dentry, struct kstatfs *buf)
        return 0;
 }
 
+static inline loff_t fat_i_pos_read(struct msdos_sb_info *sbi,
+                                   struct inode *inode)
+{
+       loff_t i_pos;
+#if BITS_PER_LONG == 32
+       spin_lock(&sbi->inode_hash_lock);
+#endif
+       i_pos = MSDOS_I(inode)->i_pos;
+#if BITS_PER_LONG == 32
+       spin_unlock(&sbi->inode_hash_lock);
+#endif
+       return i_pos;
+}
+
 static int fat_write_inode(struct inode *inode, int wait)
 {
        struct super_block *sb = inode->i_sb;
@@ -551,9 +565,12 @@ static int fat_write_inode(struct inode *inode, int wait)
        loff_t i_pos;
        int err;
 
+       if (inode->i_ino == MSDOS_ROOT_INO)
+               return 0;
+
 retry:
-       i_pos = MSDOS_I(inode)->i_pos;
-       if (inode->i_ino == MSDOS_ROOT_INO || !i_pos)
+       i_pos = fat_i_pos_read(sbi, inode);
+       if (!i_pos)
                return 0;
 
        bh = sb_bread(sb, i_pos >> sbi->dir_per_block_bits);
@@ -732,6 +749,8 @@ static struct dentry *fat_get_parent(struct dentry *child)
        brelse(bh);
 
        parent = d_obtain_alias(inode);
+       if (!IS_ERR(parent))
+               parent->d_op = sb->s_root->d_op;
 out:
        unlock_super(sb);