omfs: stop playing silly buggers with omfs_unlink() in ->rename()
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 4 Mar 2011 06:18:19 +0000 (01:18 -0500)
committerBob Copeland <me@bobcopeland.com>
Sat, 5 Mar 2011 21:23:39 +0000 (16:23 -0500)
Since omfs directories are hashes of inodes and name is part of
inode, we have to remove inode from old directory before we can
put it into new one / under new name.  So instead of
bump i_nlink
call omfs_unlink, which does
omfs_delete_entry()
decrement i_nlink and mark parent dirty in case of success
decrement i_nlink if omfs_unlink failed and hadn't done it itself
let's just call omfs_delete_entry() and dirty the parent ourselves...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
fs/omfs/dir.c

index 9990fc8..a4c2d31 100644 (file)
@@ -412,12 +412,11 @@ static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        /* since omfs locates files by name, we need to unlink _before_
         * adding the new link or we won't find the old one */
        inode_inc_link_count(old_inode);
-       err = omfs_unlink(old_dir, old_dentry);
-       if (err) {
-               inode_dec_link_count(old_inode);
+       err = omfs_delete_entry(old_dentry);
+       if (err)
                goto out;
-       }
 
+       mark_inode_dirty(old_dir);
        err = omfs_add_link(new_dentry, old_inode);
        if (err)
                goto out;