]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/jffs2/dir.c
Merge branches 'irq-core-for-linus' and 'core-locking-for-linus' of git://git.kernel...
[karo-tx-linux.git] / fs / jffs2 / dir.c
index 166062a682304be3361b93ffe5efffa3456fdc96..92978658ed1803bc289840500e8a220cbf032ffa 100644 (file)
@@ -2,6 +2,7 @@
  * JFFS2 -- Journalling Flash File System, Version 2.
  *
  * Copyright © 2001-2007 Red Hat, Inc.
+ * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
  *
  * Created by David Woodhouse <dwmw2@infradead.org>
  *
@@ -232,9 +233,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode,
        return 0;
 
  fail:
-       make_bad_inode(inode);
-       unlock_new_inode(inode);
-       iput(inode);
+       iget_failed(inode);
        jffs2_free_raw_inode(ri);
        return ret;
 }
@@ -290,7 +289,7 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de
                mutex_unlock(&f->sem);
                d_instantiate(dentry, old_dentry->d_inode);
                dir_i->i_mtime = dir_i->i_ctime = ITIME(now);
-               atomic_inc(&old_dentry->d_inode->i_count);
+               ihold(old_dentry->d_inode);
        }
        return ret;
 }
@@ -368,7 +367,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
        }
 
        /* We use f->target field to store the target path. */
-       f->target = kmalloc(targetlen + 1, GFP_KERNEL);
+       f->target = kmemdup(target, targetlen + 1, GFP_KERNEL);
        if (!f->target) {
                printk(KERN_WARNING "Can't allocate %d bytes of memory\n", targetlen + 1);
                mutex_unlock(&f->sem);
@@ -377,7 +376,6 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
                goto fail;
        }
 
-       memcpy(f->target, target, targetlen + 1);
        D1(printk(KERN_DEBUG "jffs2_symlink: symlink's target '%s' cached\n", (char *)f->target));
 
        /* No data here. Only a metadata node, which will be
@@ -454,9 +452,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
        return 0;
 
  fail:
-       make_bad_inode(inode);
-       unlock_new_inode(inode);
-       iput(inode);
+       iget_failed(inode);
        return ret;
 }
 
@@ -601,9 +597,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
        return 0;
 
  fail:
-       make_bad_inode(inode);
-       unlock_new_inode(inode);
-       iput(inode);
+       iget_failed(inode);
        return ret;
 }
 
@@ -778,9 +772,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de
        return 0;
 
  fail:
-       make_bad_inode(inode);
-       unlock_new_inode(inode);
-       iput(inode);
+       iget_failed(inode);
        return ret;
 }
 
@@ -871,7 +863,7 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
                printk(KERN_NOTICE "jffs2_rename(): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret);
                /* Might as well let the VFS know */
                d_instantiate(new_dentry, old_dentry->d_inode);
-               atomic_inc(&old_dentry->d_inode->i_count);
+               ihold(old_dentry->d_inode);
                new_dir_i->i_mtime = new_dir_i->i_ctime = ITIME(now);
                return ret;
        }