diff options
Diffstat (limited to 'fs/ext2/namei.c')
-rw-r--r-- | fs/ext2/namei.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index 90ea17998a73..e1dedb0f7873 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
@@ -66,8 +66,16 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, str | |||
66 | inode = NULL; | 66 | inode = NULL; |
67 | if (ino) { | 67 | if (ino) { |
68 | inode = ext2_iget(dir->i_sb, ino); | 68 | inode = ext2_iget(dir->i_sb, ino); |
69 | if (IS_ERR(inode)) | 69 | if (unlikely(IS_ERR(inode))) { |
70 | return ERR_CAST(inode); | 70 | if (PTR_ERR(inode) == -ESTALE) { |
71 | ext2_error(dir->i_sb, __func__, | ||
72 | "deleted inode referenced: %lu", | ||
73 | ino); | ||
74 | return ERR_PTR(-EIO); | ||
75 | } else { | ||
76 | return ERR_CAST(inode); | ||
77 | } | ||
78 | } | ||
71 | } | 79 | } |
72 | return d_splice_alias(inode, dentry); | 80 | return d_splice_alias(inode, dentry); |
73 | } | 81 | } |
@@ -320,7 +328,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, | |||
320 | if (!new_de) | 328 | if (!new_de) |
321 | goto out_dir; | 329 | goto out_dir; |
322 | inode_inc_link_count(old_inode); | 330 | inode_inc_link_count(old_inode); |
323 | ext2_set_link(new_dir, new_de, new_page, old_inode); | 331 | ext2_set_link(new_dir, new_de, new_page, old_inode, 1); |
324 | new_inode->i_ctime = CURRENT_TIME_SEC; | 332 | new_inode->i_ctime = CURRENT_TIME_SEC; |
325 | if (dir_de) | 333 | if (dir_de) |
326 | drop_nlink(new_inode); | 334 | drop_nlink(new_inode); |
@@ -352,7 +360,8 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, | |||
352 | inode_dec_link_count(old_inode); | 360 | inode_dec_link_count(old_inode); |
353 | 361 | ||
354 | if (dir_de) { | 362 | if (dir_de) { |
355 | ext2_set_link(old_inode, dir_de, dir_page, new_dir); | 363 | if (old_dir != new_dir) |
364 | ext2_set_link(old_inode, dir_de, dir_page, new_dir, 0); | ||
356 | inode_dec_link_count(old_dir); | 365 | inode_dec_link_count(old_dir); |
357 | } | 366 | } |
358 | return 0; | 367 | return 0; |