提交 7eb4969e 编写于 作者: J Jan Kara

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: NJan Kara <jack@suse.cz>
上级 ab94c39b
...@@ -1785,8 +1785,9 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb, ...@@ -1785,8 +1785,9 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
handle = ext3_journal_start(inode, 2); handle = ext3_journal_start(inode, 2);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
/* This is really bad luck. We've written the data /* This is really bad luck. We've written the data
* but cannot extend i_size. Bail out and pretend * but cannot extend i_size. Truncate allocated blocks
* the write failed... */ * and pretend the write failed... */
ext3_truncate(inode);
ret = PTR_ERR(handle); ret = PTR_ERR(handle);
goto out; goto out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册