Skip to content

Commit 7eb4969

Browse files
committed
ext3: Truncate allocated blocks if direct IO write fails to update i_size
We have to truncate blocks allocated to file during direct IO when we fail to update i_size properly. Signed-off-by: Jan Kara <jack@suse.cz>
1 parent ab94c39 commit 7eb4969

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎fs/ext3/inode.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,8 +1785,9 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
17851785
handle = ext3_journal_start(inode, 2);
17861786
if (IS_ERR(handle)) {
17871787
/* This is really bad luck. We've written the data
1788-
* but cannot extend i_size. Bail out and pretend
1789-
* the write failed... */
1788+
* but cannot extend i_size. Truncate allocated blocks
1789+
* and pretend the write failed... */
1790+
ext3_truncate(inode);
17901791
ret = PTR_ERR(handle);
17911792
goto out;
17921793
}

0 commit comments

Comments
 (0)