mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 06:50:58 +07:00
fs: Allow a NULL pos pointer to __kernel_write
Linus prefers that callers be allowed to pass in a NULL pointer for ppos like new_sync_write(). Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
5ae4998b5d
commit
4c207ef482
@ -544,10 +544,11 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t
|
|||||||
return warn_unsupported(file, "write");
|
return warn_unsupported(file, "write");
|
||||||
|
|
||||||
init_sync_kiocb(&kiocb, file);
|
init_sync_kiocb(&kiocb, file);
|
||||||
kiocb.ki_pos = *pos;
|
kiocb.ki_pos = pos ? *pos : 0;
|
||||||
iov_iter_kvec(&iter, WRITE, &iov, 1, iov.iov_len);
|
iov_iter_kvec(&iter, WRITE, &iov, 1, iov.iov_len);
|
||||||
ret = file->f_op->write_iter(&kiocb, &iter);
|
ret = file->f_op->write_iter(&kiocb, &iter);
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
|
if (pos)
|
||||||
*pos = kiocb.ki_pos;
|
*pos = kiocb.ki_pos;
|
||||||
fsnotify_modify(file);
|
fsnotify_modify(file);
|
||||||
add_wchar(current, ret);
|
add_wchar(current, ret);
|
||||||
|
Loading…
Reference in New Issue
Block a user