aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r--fs/ocfs2/file.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 8d3225a78073..e2570a3bc2b2 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -247,8 +247,8 @@ int ocfs2_update_inode_atime(struct inode *inode,
247 mlog_entry_void(); 247 mlog_entry_void();
248 248
249 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); 249 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
250 if (handle == NULL) { 250 if (IS_ERR(handle)) {
251 ret = -ENOMEM; 251 ret = PTR_ERR(handle);
252 mlog_errno(ret); 252 mlog_errno(ret);
253 goto out; 253 goto out;
254 } 254 }
@@ -312,8 +312,8 @@ static int ocfs2_simple_size_update(struct inode *inode,
312 handle_t *handle = NULL; 312 handle_t *handle = NULL;
313 313
314 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); 314 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
315 if (handle == NULL) { 315 if (IS_ERR(handle)) {
316 ret = -ENOMEM; 316 ret = PTR_ERR(handle);
317 mlog_errno(ret); 317 mlog_errno(ret);
318 goto out; 318 goto out;
319 } 319 }
@@ -679,8 +679,7 @@ leave:
679 679
680/* Some parts of this taken from generic_cont_expand, which turned out 680/* Some parts of this taken from generic_cont_expand, which turned out
681 * to be too fragile to do exactly what we need without us having to 681 * to be too fragile to do exactly what we need without us having to
682 * worry about recursive locking in ->prepare_write() and 682 * worry about recursive locking in ->write_begin() and ->write_end(). */
683 * ->commit_write(). */
684static int ocfs2_write_zero_page(struct inode *inode, 683static int ocfs2_write_zero_page(struct inode *inode,
685 u64 size) 684 u64 size)
686{ 685{
@@ -1056,8 +1055,8 @@ static int __ocfs2_write_remove_suid(struct inode *inode,
1056 (unsigned long long)OCFS2_I(inode)->ip_blkno, inode->i_mode); 1055 (unsigned long long)OCFS2_I(inode)->ip_blkno, inode->i_mode);
1057 1056
1058 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); 1057 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
1059 if (handle == NULL) { 1058 if (IS_ERR(handle)) {
1060 ret = -ENOMEM; 1059 ret = PTR_ERR(handle);
1061 mlog_errno(ret); 1060 mlog_errno(ret);
1062 goto out; 1061 goto out;
1063 } 1062 }
@@ -1260,8 +1259,8 @@ static int __ocfs2_remove_inode_range(struct inode *inode,
1260 } 1259 }
1261 1260
1262 handle = ocfs2_start_trans(osb, OCFS2_REMOVE_EXTENT_CREDITS); 1261 handle = ocfs2_start_trans(osb, OCFS2_REMOVE_EXTENT_CREDITS);
1263 if (handle == NULL) { 1262 if (IS_ERR(handle)) {
1264 ret = -ENOMEM; 1263 ret = PTR_ERR(handle);
1265 mlog_errno(ret); 1264 mlog_errno(ret);
1266 goto out; 1265 goto out;
1267 } 1266 }
@@ -1353,8 +1352,8 @@ static int ocfs2_zero_partial_clusters(struct inode *inode,
1353 goto out; 1352 goto out;
1354 1353
1355 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); 1354 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
1356 if (handle == NULL) { 1355 if (IS_ERR(handle)) {
1357 ret = -ENOMEM; 1356 ret = PTR_ERR(handle);
1358 mlog_errno(ret); 1357 mlog_errno(ret);
1359 goto out; 1358 goto out;
1360 } 1359 }
@@ -1867,6 +1866,13 @@ relock:
1867 written = generic_file_direct_write(iocb, iov, &nr_segs, *ppos, 1866 written = generic_file_direct_write(iocb, iov, &nr_segs, *ppos,
1868 ppos, count, ocount); 1867 ppos, count, ocount);
1869 if (written < 0) { 1868 if (written < 0) {
1869 /*
1870 * direct write may have instantiated a few
1871 * blocks outside i_size. Trim these off again.
1872 * Don't need i_size_read because we hold i_mutex.
1873 */
1874 if (*ppos + count > inode->i_size)
1875 vmtruncate(inode, inode->i_size);
1870 ret = written; 1876 ret = written;
1871 goto out_dio; 1877 goto out_dio;
1872 } 1878 }