aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2006-10-03 20:44:42 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2006-10-20 18:27:26 -0400
commit0effef776ff95b7a6d6e48a2ef407ecaa8c21f96 (patch)
tree518ac195b10e415bd3c87f6f7c5ddec4c8448058 /fs/ocfs2
parent711a40fcaa83bfad87736544b69f6fdd6527482d (diff)
ocfs2: fix page zeroing during simple extends
The page zeroing code was missing the region between old i_size and new i_size for those extends that didn't actually require a change in space allocation. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/file.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index d9ba0a931a03..b499c329257b 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -728,31 +728,36 @@ static int ocfs2_extend_file(struct inode *inode,
728 clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size) - 728 clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size) -
729 OCFS2_I(inode)->ip_clusters; 729 OCFS2_I(inode)->ip_clusters;
730 730
731 if (clusters_to_add) { 731 /*
732 /* 732 * protect the pages that ocfs2_zero_extend is going to be
733 * protect the pages that ocfs2_zero_extend is going to 733 * pulling into the page cache.. we do this before the
734 * be pulling into the page cache.. we do this before the 734 * metadata extend so that we don't get into the situation
735 * metadata extend so that we don't get into the situation 735 * where we've extended the metadata but can't get the data
736 * where we've extended the metadata but can't get the data 736 * lock to zero.
737 * lock to zero. 737 */
738 */ 738 ret = ocfs2_data_lock(inode, 1);
739 ret = ocfs2_data_lock(inode, 1); 739 if (ret < 0) {
740 if (ret < 0) { 740 mlog_errno(ret);
741 mlog_errno(ret); 741 goto out;
742 goto out; 742 }
743 }
744 743
744 if (clusters_to_add) {
745 ret = ocfs2_extend_allocation(inode, clusters_to_add); 745 ret = ocfs2_extend_allocation(inode, clusters_to_add);
746 if (ret < 0) { 746 if (ret < 0) {
747 mlog_errno(ret); 747 mlog_errno(ret);
748 goto out_unlock; 748 goto out_unlock;
749 } 749 }
750 }
750 751
751 ret = ocfs2_zero_extend(inode, (u64)new_i_size - tail_to_skip); 752 /*
752 if (ret < 0) { 753 * Call this even if we don't add any clusters to the tree. We
753 mlog_errno(ret); 754 * still need to zero the area between the old i_size and the
754 goto out_unlock; 755 * new i_size.
755 } 756 */
757 ret = ocfs2_zero_extend(inode, (u64)new_i_size - tail_to_skip);
758 if (ret < 0) {
759 mlog_errno(ret);
760 goto out_unlock;
756 } 761 }
757 762
758 if (!tail_to_skip) { 763 if (!tail_to_skip) {
@@ -764,8 +769,7 @@ static int ocfs2_extend_file(struct inode *inode,
764 } 769 }
765 770
766out_unlock: 771out_unlock:
767 if (clusters_to_add) /* this is the only case in which we lock */ 772 ocfs2_data_unlock(inode, 1);
768 ocfs2_data_unlock(inode, 1);
769 773
770out: 774out:
771 return ret; 775 return ret;