diff options
| -rw-r--r-- | fs/ocfs2/namei.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index b66e48855825..8ff035eabfd8 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
| @@ -445,11 +445,6 @@ leave: | |||
| 445 | 445 | ||
| 446 | ocfs2_free_dir_lookup_result(&lookup); | 446 | ocfs2_free_dir_lookup_result(&lookup); |
| 447 | 447 | ||
| 448 | if ((status < 0) && inode) { | ||
| 449 | clear_nlink(inode); | ||
| 450 | iput(inode); | ||
| 451 | } | ||
| 452 | |||
| 453 | if (inode_ac) | 448 | if (inode_ac) |
| 454 | ocfs2_free_alloc_context(inode_ac); | 449 | ocfs2_free_alloc_context(inode_ac); |
| 455 | 450 | ||
| @@ -459,6 +454,17 @@ leave: | |||
| 459 | if (meta_ac) | 454 | if (meta_ac) |
| 460 | ocfs2_free_alloc_context(meta_ac); | 455 | ocfs2_free_alloc_context(meta_ac); |
| 461 | 456 | ||
| 457 | /* | ||
| 458 | * We should call iput after the i_mutex of the bitmap been | ||
| 459 | * unlocked in ocfs2_free_alloc_context, or the | ||
| 460 | * ocfs2_delete_inode will mutex_lock again. | ||
| 461 | */ | ||
| 462 | if ((status < 0) && inode) { | ||
| 463 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SKIP_ORPHAN_DIR; | ||
| 464 | clear_nlink(inode); | ||
| 465 | iput(inode); | ||
| 466 | } | ||
| 467 | |||
| 462 | mlog_exit(status); | 468 | mlog_exit(status); |
| 463 | 469 | ||
| 464 | return status; | 470 | return status; |
