diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-02 09:38:45 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-03 01:28:16 -0500 |
commit | 4787d45fa76b97e224a8299086bb5fb496275796 (patch) | |
tree | 8473ed7fd9d5bc00a8720340d226d7478f4163e6 /fs/sysv | |
parent | cbdbb4c1d22e26f9d5314fefe6f2c7e5ed7f6a0f (diff) | |
download | linux-3.10-4787d45fa76b97e224a8299086bb5fb496275796.tar.gz linux-3.10-4787d45fa76b97e224a8299086bb5fb496275796.tar.bz2 linux-3.10-4787d45fa76b97e224a8299086bb5fb496275796.zip |
sysv: i_nlink races in rename()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/sysv')
-rw-r--r-- | fs/sysv/namei.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c index b427b1208c2..e474fbcf8bd 100644 --- a/fs/sysv/namei.c +++ b/fs/sysv/namei.c @@ -245,7 +245,6 @@ static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, new_de = sysv_find_entry(new_dentry, &new_page); if (!new_de) goto out_dir; - inode_inc_link_count(old_inode); sysv_set_link(new_de, new_page, old_inode); new_inode->i_ctime = CURRENT_TIME_SEC; if (dir_de) @@ -257,18 +256,15 @@ static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, if (new_dir->i_nlink >= SYSV_SB(new_dir->i_sb)->s_link_max) goto out_dir; } - inode_inc_link_count(old_inode); err = sysv_add_link(new_dentry, old_inode); - if (err) { - inode_dec_link_count(old_inode); + if (err) goto out_dir; - } if (dir_de) inode_inc_link_count(new_dir); } sysv_delete_entry(old_de, old_page); - inode_dec_link_count(old_inode); + mark_inode_dirty(old_inode); if (dir_de) { sysv_set_link(dir_de, dir_page, new_dir); |