提交 f765b134 编写于 作者: A Al Viro

new_sync_write(): discard ->ki_pos unless the return value is positive

That allows ->write_iter() instances much more convenient life wrt
iocb->ki_pos (and fixes several filesystems with borderline POSIX
violations when zero-length write succeeds and changes the current
position).
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 22c6186e
...@@ -477,7 +477,8 @@ static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t ...@@ -477,7 +477,8 @@ static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t
ret = filp->f_op->write_iter(&kiocb, &iter); ret = filp->f_op->write_iter(&kiocb, &iter);
BUG_ON(ret == -EIOCBQUEUED); BUG_ON(ret == -EIOCBQUEUED);
*ppos = kiocb.ki_pos; if (ret > 0)
*ppos = kiocb.ki_pos;
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册