diff options
-rw-r--r-- | fs/ocfs2/dir.c | 7 | ||||
-rw-r--r-- | fs/ocfs2/inode.c | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 67e6866a2a4f..c441ef1f2bad 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -403,7 +403,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, | |||
403 | struct buffer_head **new_de_bh) | 403 | struct buffer_head **new_de_bh) |
404 | { | 404 | { |
405 | int status = 0; | 405 | int status = 0; |
406 | int credits, num_free_extents; | 406 | int credits, num_free_extents, drop_alloc_sem = 0; |
407 | loff_t dir_i_size; | 407 | loff_t dir_i_size; |
408 | struct ocfs2_dinode *fe = (struct ocfs2_dinode *) parent_fe_bh->b_data; | 408 | struct ocfs2_dinode *fe = (struct ocfs2_dinode *) parent_fe_bh->b_data; |
409 | struct ocfs2_alloc_context *data_ac = NULL; | 409 | struct ocfs2_alloc_context *data_ac = NULL; |
@@ -452,6 +452,9 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, | |||
452 | credits = OCFS2_SIMPLE_DIR_EXTEND_CREDITS; | 452 | credits = OCFS2_SIMPLE_DIR_EXTEND_CREDITS; |
453 | } | 453 | } |
454 | 454 | ||
455 | down_write(&OCFS2_I(dir)->ip_alloc_sem); | ||
456 | drop_alloc_sem = 1; | ||
457 | |||
455 | handle = ocfs2_start_trans(osb, credits); | 458 | handle = ocfs2_start_trans(osb, credits); |
456 | if (IS_ERR(handle)) { | 459 | if (IS_ERR(handle)) { |
457 | status = PTR_ERR(handle); | 460 | status = PTR_ERR(handle); |
@@ -497,6 +500,8 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, | |||
497 | *new_de_bh = new_bh; | 500 | *new_de_bh = new_bh; |
498 | get_bh(*new_de_bh); | 501 | get_bh(*new_de_bh); |
499 | bail: | 502 | bail: |
503 | if (drop_alloc_sem) | ||
504 | up_write(&OCFS2_I(dir)->ip_alloc_sem); | ||
500 | if (handle) | 505 | if (handle) |
501 | ocfs2_commit_trans(osb, handle); | 506 | ocfs2_commit_trans(osb, handle); |
502 | 507 | ||
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 21a605079c62..58ec54b60038 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -1106,8 +1106,10 @@ struct buffer_head *ocfs2_bread(struct inode *inode, | |||
1106 | return NULL; | 1106 | return NULL; |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | down_read(&OCFS2_I(inode)->ip_alloc_sem); | ||
1109 | tmperr = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL, | 1110 | tmperr = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL, |
1110 | NULL); | 1111 | NULL); |
1112 | up_read(&OCFS2_I(inode)->ip_alloc_sem); | ||
1111 | if (tmperr < 0) { | 1113 | if (tmperr < 0) { |
1112 | mlog_errno(tmperr); | 1114 | mlog_errno(tmperr); |
1113 | goto fail; | 1115 | goto fail; |