aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/hfsplus/extents.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index 136d860cd746..a7aafb35b624 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -496,11 +496,13 @@ int hfsplus_file_extend(struct inode *inode)
496 goto insert_extent; 496 goto insert_extent;
497 } 497 }
498out: 498out:
499 mutex_unlock(&hip->extents_lock);
500 if (!res) { 499 if (!res) {
501 hip->alloc_blocks += len; 500 hip->alloc_blocks += len;
501 mutex_unlock(&hip->extents_lock);
502 hfsplus_mark_inode_dirty(inode, HFSPLUS_I_ALLOC_DIRTY); 502 hfsplus_mark_inode_dirty(inode, HFSPLUS_I_ALLOC_DIRTY);
503 return 0;
503 } 504 }
505 mutex_unlock(&hip->extents_lock);
504 return res; 506 return res;
505 507
506insert_extent: 508insert_extent:
@@ -554,11 +556,13 @@ void hfsplus_file_truncate(struct inode *inode)
554 556
555 blk_cnt = (inode->i_size + HFSPLUS_SB(sb)->alloc_blksz - 1) >> 557 blk_cnt = (inode->i_size + HFSPLUS_SB(sb)->alloc_blksz - 1) >>
556 HFSPLUS_SB(sb)->alloc_blksz_shift; 558 HFSPLUS_SB(sb)->alloc_blksz_shift;
559
560 mutex_lock(&hip->extents_lock);
561
557 alloc_cnt = hip->alloc_blocks; 562 alloc_cnt = hip->alloc_blocks;
558 if (blk_cnt == alloc_cnt) 563 if (blk_cnt == alloc_cnt)
559 goto out; 564 goto out_unlock;
560 565
561 mutex_lock(&hip->extents_lock);
562 res = hfs_find_init(HFSPLUS_SB(sb)->ext_tree, &fd); 566 res = hfs_find_init(HFSPLUS_SB(sb)->ext_tree, &fd);
563 if (res) { 567 if (res) {
564 mutex_unlock(&hip->extents_lock); 568 mutex_unlock(&hip->extents_lock);
@@ -590,10 +594,10 @@ void hfsplus_file_truncate(struct inode *inode)
590 hfs_brec_remove(&fd); 594 hfs_brec_remove(&fd);
591 } 595 }
592 hfs_find_exit(&fd); 596 hfs_find_exit(&fd);
593 mutex_unlock(&hip->extents_lock);
594 597
595 hip->alloc_blocks = blk_cnt; 598 hip->alloc_blocks = blk_cnt;
596out: 599out_unlock:
600 mutex_unlock(&hip->extents_lock);
597 hip->phys_size = inode->i_size; 601 hip->phys_size = inode->i_size;
598 hip->fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> 602 hip->fs_blocks = (inode->i_size + sb->s_blocksize - 1) >>
599 sb->s_blocksize_bits; 603 sb->s_blocksize_bits;