diff options
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r-- | fs/ocfs2/file.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 7efe937a415f..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 | } |
@@ -1055,8 +1055,8 @@ static int __ocfs2_write_remove_suid(struct inode *inode, | |||
1055 | (unsigned long long)OCFS2_I(inode)->ip_blkno, inode->i_mode); | 1055 | (unsigned long long)OCFS2_I(inode)->ip_blkno, inode->i_mode); |
1056 | 1056 | ||
1057 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); | 1057 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); |
1058 | if (handle == NULL) { | 1058 | if (IS_ERR(handle)) { |
1059 | ret = -ENOMEM; | 1059 | ret = PTR_ERR(handle); |
1060 | mlog_errno(ret); | 1060 | mlog_errno(ret); |
1061 | goto out; | 1061 | goto out; |
1062 | } | 1062 | } |
@@ -1259,8 +1259,8 @@ static int __ocfs2_remove_inode_range(struct inode *inode, | |||
1259 | } | 1259 | } |
1260 | 1260 | ||
1261 | handle = ocfs2_start_trans(osb, OCFS2_REMOVE_EXTENT_CREDITS); | 1261 | handle = ocfs2_start_trans(osb, OCFS2_REMOVE_EXTENT_CREDITS); |
1262 | if (handle == NULL) { | 1262 | if (IS_ERR(handle)) { |
1263 | ret = -ENOMEM; | 1263 | ret = PTR_ERR(handle); |
1264 | mlog_errno(ret); | 1264 | mlog_errno(ret); |
1265 | goto out; | 1265 | goto out; |
1266 | } | 1266 | } |
@@ -1352,8 +1352,8 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, | |||
1352 | goto out; | 1352 | goto out; |
1353 | 1353 | ||
1354 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); | 1354 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); |
1355 | if (handle == NULL) { | 1355 | if (IS_ERR(handle)) { |
1356 | ret = -ENOMEM; | 1356 | ret = PTR_ERR(handle); |
1357 | mlog_errno(ret); | 1357 | mlog_errno(ret); |
1358 | goto out; | 1358 | goto out; |
1359 | } | 1359 | } |
@@ -1866,6 +1866,13 @@ relock: | |||
1866 | written = generic_file_direct_write(iocb, iov, &nr_segs, *ppos, | 1866 | written = generic_file_direct_write(iocb, iov, &nr_segs, *ppos, |
1867 | ppos, count, ocount); | 1867 | ppos, count, ocount); |
1868 | 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); | ||
1869 | ret = written; | 1876 | ret = written; |
1870 | goto out_dio; | 1877 | goto out_dio; |
1871 | } | 1878 | } |