diff options
Diffstat (limited to 'fs/ocfs2/inode.c')
-rw-r--r-- | fs/ocfs2/inode.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 0bd86a137591..78c99b5050df 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -489,12 +489,38 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, | |||
489 | int status = 0; | 489 | int status = 0; |
490 | struct ocfs2_truncate_context *tc = NULL; | 490 | struct ocfs2_truncate_context *tc = NULL; |
491 | struct ocfs2_dinode *fe; | 491 | struct ocfs2_dinode *fe; |
492 | handle_t *handle = NULL; | ||
492 | 493 | ||
493 | mlog_entry_void(); | 494 | mlog_entry_void(); |
494 | 495 | ||
495 | fe = (struct ocfs2_dinode *) fe_bh->b_data; | 496 | fe = (struct ocfs2_dinode *) fe_bh->b_data; |
496 | 497 | ||
497 | if (fe->i_clusters) { | 498 | if (fe->i_clusters) { |
499 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); | ||
500 | if (IS_ERR(handle)) { | ||
501 | status = PTR_ERR(handle); | ||
502 | mlog_errno(status); | ||
503 | goto out; | ||
504 | } | ||
505 | |||
506 | status = ocfs2_journal_access(handle, inode, fe_bh, | ||
507 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
508 | if (status < 0) { | ||
509 | mlog_errno(status); | ||
510 | goto out; | ||
511 | } | ||
512 | |||
513 | i_size_write(inode, 0); | ||
514 | |||
515 | status = ocfs2_mark_inode_dirty(handle, inode, fe_bh); | ||
516 | if (status < 0) { | ||
517 | mlog_errno(status); | ||
518 | goto out; | ||
519 | } | ||
520 | |||
521 | ocfs2_commit_trans(osb, handle); | ||
522 | handle = NULL; | ||
523 | |||
498 | status = ocfs2_prepare_truncate(osb, inode, fe_bh, &tc); | 524 | status = ocfs2_prepare_truncate(osb, inode, fe_bh, &tc); |
499 | if (status < 0) { | 525 | if (status < 0) { |
500 | mlog_errno(status); | 526 | mlog_errno(status); |
@@ -507,8 +533,10 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, | |||
507 | goto out; | 533 | goto out; |
508 | } | 534 | } |
509 | } | 535 | } |
510 | out: | ||
511 | 536 | ||
537 | out: | ||
538 | if (handle) | ||
539 | ocfs2_commit_trans(osb, handle); | ||
512 | mlog_exit(status); | 540 | mlog_exit(status); |
513 | return status; | 541 | return status; |
514 | } | 542 | } |