diff options
-rw-r--r-- | fs/ocfs2/namei.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index f64cff0ceed8..7e9da946c777 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -1603,19 +1603,12 @@ static int ocfs2_symlink(struct inode *dir, | |||
1603 | 1603 | ||
1604 | credits = ocfs2_calc_symlink_credits(sb); | 1604 | credits = ocfs2_calc_symlink_credits(sb); |
1605 | 1605 | ||
1606 | handle = ocfs2_alloc_handle(osb); | ||
1607 | if (handle == NULL) { | ||
1608 | status = -ENOMEM; | ||
1609 | mlog_errno(status); | ||
1610 | goto bail; | ||
1611 | } | ||
1612 | |||
1613 | /* lock the parent directory */ | 1606 | /* lock the parent directory */ |
1614 | status = ocfs2_meta_lock(dir, handle, &parent_fe_bh, 1); | 1607 | status = ocfs2_meta_lock(dir, NULL, &parent_fe_bh, 1); |
1615 | if (status < 0) { | 1608 | if (status < 0) { |
1616 | if (status != -ENOENT) | 1609 | if (status != -ENOENT) |
1617 | mlog_errno(status); | 1610 | mlog_errno(status); |
1618 | goto bail; | 1611 | return status; |
1619 | } | 1612 | } |
1620 | 1613 | ||
1621 | dirfe = (struct ocfs2_dinode *) parent_fe_bh->b_data; | 1614 | dirfe = (struct ocfs2_dinode *) parent_fe_bh->b_data; |
@@ -1638,6 +1631,13 @@ static int ocfs2_symlink(struct inode *dir, | |||
1638 | goto bail; | 1631 | goto bail; |
1639 | } | 1632 | } |
1640 | 1633 | ||
1634 | handle = ocfs2_alloc_handle(osb); | ||
1635 | if (handle == NULL) { | ||
1636 | status = -ENOMEM; | ||
1637 | mlog_errno(status); | ||
1638 | goto bail; | ||
1639 | } | ||
1640 | |||
1641 | status = ocfs2_reserve_new_inode(osb, handle, &inode_ac); | 1641 | status = ocfs2_reserve_new_inode(osb, handle, &inode_ac); |
1642 | if (status < 0) { | 1642 | if (status < 0) { |
1643 | if (status != -ENOSPC) | 1643 | if (status != -ENOSPC) |
@@ -1734,6 +1734,9 @@ static int ocfs2_symlink(struct inode *dir, | |||
1734 | bail: | 1734 | bail: |
1735 | if (handle) | 1735 | if (handle) |
1736 | ocfs2_commit_trans(handle); | 1736 | ocfs2_commit_trans(handle); |
1737 | |||
1738 | ocfs2_meta_unlock(dir, 1); | ||
1739 | |||
1737 | if (new_fe_bh) | 1740 | if (new_fe_bh) |
1738 | brelse(new_fe_bh); | 1741 | brelse(new_fe_bh); |
1739 | if (parent_fe_bh) | 1742 | if (parent_fe_bh) |