diff options
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r-- | fs/ocfs2/file.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index c4034f693e7b..4ffa715be09c 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -187,6 +187,7 @@ int ocfs2_update_inode_atime(struct inode *inode, | |||
187 | int ret; | 187 | int ret; |
188 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 188 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
189 | handle_t *handle; | 189 | handle_t *handle; |
190 | struct ocfs2_dinode *di = (struct ocfs2_dinode *) bh->b_data; | ||
190 | 191 | ||
191 | mlog_entry_void(); | 192 | mlog_entry_void(); |
192 | 193 | ||
@@ -197,11 +198,27 @@ int ocfs2_update_inode_atime(struct inode *inode, | |||
197 | goto out; | 198 | goto out; |
198 | } | 199 | } |
199 | 200 | ||
201 | ret = ocfs2_journal_access(handle, inode, bh, | ||
202 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
203 | if (ret) { | ||
204 | mlog_errno(ret); | ||
205 | goto out_commit; | ||
206 | } | ||
207 | |||
208 | /* | ||
209 | * Don't use ocfs2_mark_inode_dirty() here as we don't always | ||
210 | * have i_mutex to guard against concurrent changes to other | ||
211 | * inode fields. | ||
212 | */ | ||
200 | inode->i_atime = CURRENT_TIME; | 213 | inode->i_atime = CURRENT_TIME; |
201 | ret = ocfs2_mark_inode_dirty(handle, inode, bh); | 214 | di->i_atime = cpu_to_le64(inode->i_atime.tv_sec); |
215 | di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); | ||
216 | |||
217 | ret = ocfs2_journal_dirty(handle, bh); | ||
202 | if (ret < 0) | 218 | if (ret < 0) |
203 | mlog_errno(ret); | 219 | mlog_errno(ret); |
204 | 220 | ||
221 | out_commit: | ||
205 | ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); | 222 | ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); |
206 | out: | 223 | out: |
207 | mlog_exit(ret); | 224 | mlog_exit(ret); |
@@ -1011,6 +1028,11 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
1011 | } | 1028 | } |
1012 | 1029 | ||
1013 | if (size_change && attr->ia_size != i_size_read(inode)) { | 1030 | if (size_change && attr->ia_size != i_size_read(inode)) { |
1031 | if (attr->ia_size > sb->s_maxbytes) { | ||
1032 | status = -EFBIG; | ||
1033 | goto bail_unlock; | ||
1034 | } | ||
1035 | |||
1014 | if (i_size_read(inode) > attr->ia_size) | 1036 | if (i_size_read(inode) > attr->ia_size) |
1015 | status = ocfs2_truncate_file(inode, bh, attr->ia_size); | 1037 | status = ocfs2_truncate_file(inode, bh, attr->ia_size); |
1016 | else | 1038 | else |
@@ -1516,7 +1538,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, | |||
1516 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1538 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1517 | struct buffer_head *di_bh = NULL; | 1539 | struct buffer_head *di_bh = NULL; |
1518 | handle_t *handle; | 1540 | handle_t *handle; |
1519 | unsigned long long max_off = ocfs2_max_file_offset(inode->i_sb->s_blocksize_bits); | 1541 | unsigned long long max_off = inode->i_sb->s_maxbytes; |
1520 | 1542 | ||
1521 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) | 1543 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) |
1522 | return -EROFS; | 1544 | return -EROFS; |
@@ -1942,7 +1964,7 @@ static ssize_t ocfs2_file_buffered_write(struct file *file, loff_t *ppos, | |||
1942 | } | 1964 | } |
1943 | 1965 | ||
1944 | dst = kmap_atomic(page, KM_USER0); | 1966 | dst = kmap_atomic(page, KM_USER0); |
1945 | memcpy(dst + (pos & (PAGE_CACHE_SIZE - 1)), buf, bytes); | 1967 | memcpy(dst + (pos & (loff_t)(PAGE_CACHE_SIZE - 1)), buf, bytes); |
1946 | kunmap_atomic(dst, KM_USER0); | 1968 | kunmap_atomic(dst, KM_USER0); |
1947 | flush_dcache_page(page); | 1969 | flush_dcache_page(page); |
1948 | ocfs2_put_write_source(user_page); | 1970 | ocfs2_put_write_source(user_page); |