| .. | .. |
|---|
| 57 | 57 | { |
|---|
| 58 | 58 | struct inode * inode; |
|---|
| 59 | 59 | ino_t ino; |
|---|
| 60 | + int res; |
|---|
| 60 | 61 | |
|---|
| 61 | 62 | if (dentry->d_name.len > EXT2_NAME_LEN) |
|---|
| 62 | 63 | return ERR_PTR(-ENAMETOOLONG); |
|---|
| 63 | 64 | |
|---|
| 64 | | - ino = ext2_inode_by_name(dir, &dentry->d_name); |
|---|
| 65 | | - inode = NULL; |
|---|
| 66 | | - if (ino) { |
|---|
| 65 | + res = ext2_inode_by_name(dir, &dentry->d_name, &ino); |
|---|
| 66 | + if (res) { |
|---|
| 67 | + if (res != -ENOENT) |
|---|
| 68 | + return ERR_PTR(res); |
|---|
| 69 | + inode = NULL; |
|---|
| 70 | + } else { |
|---|
| 67 | 71 | inode = ext2_iget(dir->i_sb, ino); |
|---|
| 68 | 72 | if (inode == ERR_PTR(-ESTALE)) { |
|---|
| 69 | 73 | ext2_error(dir->i_sb, __func__, |
|---|
| .. | .. |
|---|
| 78 | 82 | struct dentry *ext2_get_parent(struct dentry *child) |
|---|
| 79 | 83 | { |
|---|
| 80 | 84 | struct qstr dotdot = QSTR_INIT("..", 2); |
|---|
| 81 | | - unsigned long ino = ext2_inode_by_name(d_inode(child), &dotdot); |
|---|
| 82 | | - if (!ino) |
|---|
| 83 | | - return ERR_PTR(-ENOENT); |
|---|
| 85 | + ino_t ino; |
|---|
| 86 | + int res; |
|---|
| 87 | + |
|---|
| 88 | + res = ext2_inode_by_name(d_inode(child), &dotdot, &ino); |
|---|
| 89 | + if (res) |
|---|
| 90 | + return ERR_PTR(res); |
|---|
| 91 | + |
|---|
| 84 | 92 | return d_obtain_alias(ext2_iget(child->d_sb, ino)); |
|---|
| 85 | 93 | } |
|---|
| 86 | 94 | |
|---|
| .. | .. |
|---|
| 136 | 144 | err = PTR_ERR(inode); |
|---|
| 137 | 145 | if (!IS_ERR(inode)) { |
|---|
| 138 | 146 | init_special_inode(inode, inode->i_mode, rdev); |
|---|
| 139 | | -#ifdef CONFIG_EXT2_FS_XATTR |
|---|
| 140 | 147 | inode->i_op = &ext2_special_inode_operations; |
|---|
| 141 | | -#endif |
|---|
| 142 | 148 | mark_inode_dirty(inode); |
|---|
| 143 | 149 | err = ext2_add_nondir(dentry, inode); |
|---|
| 144 | 150 | } |
|---|
| .. | .. |
|---|
| 276 | 282 | if (err) |
|---|
| 277 | 283 | goto out; |
|---|
| 278 | 284 | |
|---|
| 279 | | - de = ext2_find_entry (dir, &dentry->d_name, &page); |
|---|
| 280 | | - if (!de) { |
|---|
| 281 | | - err = -ENOENT; |
|---|
| 285 | + de = ext2_find_entry(dir, &dentry->d_name, &page); |
|---|
| 286 | + if (IS_ERR(de)) { |
|---|
| 287 | + err = PTR_ERR(de); |
|---|
| 282 | 288 | goto out; |
|---|
| 283 | 289 | } |
|---|
| 284 | 290 | |
|---|
| .. | .. |
|---|
| 332 | 338 | if (err) |
|---|
| 333 | 339 | goto out; |
|---|
| 334 | 340 | |
|---|
| 335 | | - old_de = ext2_find_entry (old_dir, &old_dentry->d_name, &old_page); |
|---|
| 336 | | - if (!old_de) { |
|---|
| 337 | | - err = -ENOENT; |
|---|
| 341 | + old_de = ext2_find_entry(old_dir, &old_dentry->d_name, &old_page); |
|---|
| 342 | + if (IS_ERR(old_de)) { |
|---|
| 343 | + err = PTR_ERR(old_de); |
|---|
| 338 | 344 | goto out; |
|---|
| 339 | 345 | } |
|---|
| 340 | 346 | |
|---|
| .. | .. |
|---|
| 353 | 359 | if (dir_de && !ext2_empty_dir (new_inode)) |
|---|
| 354 | 360 | goto out_dir; |
|---|
| 355 | 361 | |
|---|
| 356 | | - err = -ENOENT; |
|---|
| 357 | | - new_de = ext2_find_entry (new_dir, &new_dentry->d_name, &new_page); |
|---|
| 358 | | - if (!new_de) |
|---|
| 362 | + new_de = ext2_find_entry(new_dir, &new_dentry->d_name, &new_page); |
|---|
| 363 | + if (IS_ERR(new_de)) { |
|---|
| 364 | + err = PTR_ERR(new_de); |
|---|
| 359 | 365 | goto out_dir; |
|---|
| 366 | + } |
|---|
| 360 | 367 | ext2_set_link(new_dir, new_de, new_page, old_inode, 1); |
|---|
| 361 | 368 | new_inode->i_ctime = current_time(new_inode); |
|---|
| 362 | 369 | if (dir_de) |
|---|
| .. | .. |
|---|
| 413 | 420 | .rmdir = ext2_rmdir, |
|---|
| 414 | 421 | .mknod = ext2_mknod, |
|---|
| 415 | 422 | .rename = ext2_rename, |
|---|
| 416 | | -#ifdef CONFIG_EXT2_FS_XATTR |
|---|
| 417 | 423 | .listxattr = ext2_listxattr, |
|---|
| 418 | | -#endif |
|---|
| 424 | + .getattr = ext2_getattr, |
|---|
| 419 | 425 | .setattr = ext2_setattr, |
|---|
| 420 | 426 | .get_acl = ext2_get_acl, |
|---|
| 421 | 427 | .set_acl = ext2_set_acl, |
|---|
| .. | .. |
|---|
| 423 | 429 | }; |
|---|
| 424 | 430 | |
|---|
| 425 | 431 | const struct inode_operations ext2_special_inode_operations = { |
|---|
| 426 | | -#ifdef CONFIG_EXT2_FS_XATTR |
|---|
| 427 | 432 | .listxattr = ext2_listxattr, |
|---|
| 428 | | -#endif |
|---|
| 433 | + .getattr = ext2_getattr, |
|---|
| 429 | 434 | .setattr = ext2_setattr, |
|---|
| 430 | 435 | .get_acl = ext2_get_acl, |
|---|
| 431 | 436 | .set_acl = ext2_set_acl, |
|---|