diff options
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r-- | fs/ocfs2/file.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 4636aa6b0117..41001d515fae 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -402,12 +402,9 @@ static int ocfs2_truncate_file(struct inode *inode, | |||
402 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 402 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
403 | (unsigned long long)new_i_size); | 403 | (unsigned long long)new_i_size); |
404 | 404 | ||
405 | /* We trust di_bh because it comes from ocfs2_inode_lock(), which | ||
406 | * already validated it */ | ||
405 | fe = (struct ocfs2_dinode *) di_bh->b_data; | 407 | fe = (struct ocfs2_dinode *) di_bh->b_data; |
406 | if (!OCFS2_IS_VALID_DINODE(fe)) { | ||
407 | OCFS2_RO_ON_INVALID_DINODE(inode->i_sb, fe); | ||
408 | status = -EIO; | ||
409 | goto bail; | ||
410 | } | ||
411 | 408 | ||
412 | mlog_bug_on_msg(le64_to_cpu(fe->i_size) != i_size_read(inode), | 409 | mlog_bug_on_msg(le64_to_cpu(fe->i_size) != i_size_read(inode), |
413 | "Inode %llu, inode i_size = %lld != di " | 410 | "Inode %llu, inode i_size = %lld != di " |
@@ -546,18 +543,12 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start, | |||
546 | */ | 543 | */ |
547 | BUG_ON(mark_unwritten && !ocfs2_sparse_alloc(osb)); | 544 | BUG_ON(mark_unwritten && !ocfs2_sparse_alloc(osb)); |
548 | 545 | ||
549 | status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh); | 546 | status = ocfs2_read_inode_block(inode, &bh); |
550 | if (status < 0) { | 547 | if (status < 0) { |
551 | mlog_errno(status); | 548 | mlog_errno(status); |
552 | goto leave; | 549 | goto leave; |
553 | } | 550 | } |
554 | |||
555 | fe = (struct ocfs2_dinode *) bh->b_data; | 551 | fe = (struct ocfs2_dinode *) bh->b_data; |
556 | if (!OCFS2_IS_VALID_DINODE(fe)) { | ||
557 | OCFS2_RO_ON_INVALID_DINODE(inode->i_sb, fe); | ||
558 | status = -EIO; | ||
559 | goto leave; | ||
560 | } | ||
561 | 552 | ||
562 | restart_all: | 553 | restart_all: |
563 | BUG_ON(le32_to_cpu(fe->i_clusters) != OCFS2_I(inode)->ip_clusters); | 554 | BUG_ON(le32_to_cpu(fe->i_clusters) != OCFS2_I(inode)->ip_clusters); |
@@ -1135,9 +1126,8 @@ static int ocfs2_write_remove_suid(struct inode *inode) | |||
1135 | { | 1126 | { |
1136 | int ret; | 1127 | int ret; |
1137 | struct buffer_head *bh = NULL; | 1128 | struct buffer_head *bh = NULL; |
1138 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | ||
1139 | 1129 | ||
1140 | ret = ocfs2_read_block(inode, oi->ip_blkno, &bh); | 1130 | ret = ocfs2_read_inode_block(inode, &bh); |
1141 | if (ret < 0) { | 1131 | if (ret < 0) { |
1142 | mlog_errno(ret); | 1132 | mlog_errno(ret); |
1143 | goto out; | 1133 | goto out; |
@@ -1163,8 +1153,7 @@ static int ocfs2_allocate_unwritten_extents(struct inode *inode, | |||
1163 | struct buffer_head *di_bh = NULL; | 1153 | struct buffer_head *di_bh = NULL; |
1164 | 1154 | ||
1165 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { | 1155 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { |
1166 | ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, | 1156 | ret = ocfs2_read_inode_block(inode, &di_bh); |
1167 | &di_bh); | ||
1168 | if (ret) { | 1157 | if (ret) { |
1169 | mlog_errno(ret); | 1158 | mlog_errno(ret); |
1170 | goto out; | 1159 | goto out; |