Commit babfe560 authored by Al Viro's avatar Al Viro

exofs: i_nlink races in rename()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 30eb43d3
...@@ -272,7 +272,6 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -272,7 +272,6 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry,
new_de = exofs_find_entry(new_dir, new_dentry, &new_page); new_de = exofs_find_entry(new_dir, new_dentry, &new_page);
if (!new_de) if (!new_de)
goto out_dir; goto out_dir;
inode_inc_link_count(old_inode);
err = exofs_set_link(new_dir, new_de, new_page, old_inode); err = exofs_set_link(new_dir, new_de, new_page, old_inode);
new_inode->i_ctime = CURRENT_TIME; new_inode->i_ctime = CURRENT_TIME;
if (dir_de) if (dir_de)
...@@ -286,12 +285,9 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -286,12 +285,9 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry,
if (new_dir->i_nlink >= EXOFS_LINK_MAX) if (new_dir->i_nlink >= EXOFS_LINK_MAX)
goto out_dir; goto out_dir;
} }
inode_inc_link_count(old_inode);
err = exofs_add_link(new_dentry, old_inode); err = exofs_add_link(new_dentry, old_inode);
if (err) { if (err)
inode_dec_link_count(old_inode);
goto out_dir; goto out_dir;
}
if (dir_de) if (dir_de)
inode_inc_link_count(new_dir); inode_inc_link_count(new_dir);
} }
...@@ -299,7 +295,7 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -299,7 +295,7 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry,
old_inode->i_ctime = CURRENT_TIME; old_inode->i_ctime = CURRENT_TIME;
exofs_delete_entry(old_de, old_page); exofs_delete_entry(old_de, old_page);
inode_dec_link_count(old_inode); mark_inode_dirty(old_inode);
if (dir_de) { if (dir_de) {
err = exofs_set_link(old_inode, dir_de, dir_page, new_dir); err = exofs_set_link(old_inode, dir_de, dir_page, new_dir);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment