fs: add the fsnotify call to vfs_iter_write
A bug has been discovered when redirecting splice output to regular files on EXT4 and tmpfs. Other filesystems might be affected. This commit fixes the issue for stable series kernel, using one of the change introduced during the rewrite and refactoring of vfs_iter_write in 4.13, specifically in the commitabbb65899a
("fs: implement vfs_iter_write using do_iter_write"). This issue affects v4.4 and v4.9 stable series of kernels. Without this fix for v4.4 and v4.9 stable, the following upstream commits (and their dependencies would need to be backported): * commitabbb65899a
("fs: implement vfs_iter_write using do_iter_write") * commit18e9710ee5
("fs: implement vfs_iter_read using do_iter_read") * commitedab5fe38c
("fs: move more code into do_iter_read/do_iter_write") * commit19c735868d
("fs: remove __do_readv_writev") * commit26c87fb7d1
("fs: remove do_compat_readv_writev") * commit251b42a1dc
("fs: remove do_readv_writev") as well as the following dependencies: * commitbb7462b6fd
("vfs: use helpers for calling f_op->{read,write}_iter()") * commit0f78d06ac1
("vfs: pass type instead of fn to do_{loop,iter}_readv_writev()") * commit7687a7a443
("vfs: extract common parts of {compat_,}do_readv_writev()") In order to reduce the changes, this commit uses only the part of commitabbb65899a
("fs: implement vfs_iter_write using do_iter_write") that fixes the issue. This issue and the reproducer can be found on https://bugzilla.kernel.org/show_bug.cgi?id=85381 Reported-by: Richard Li <richardpku@gmail.com> Reported-by: Chad Miller <millchad@amazon.com> Reviewed-by: Stefan Nuernberger <snu@amazon.de> Reviewed-by: Frank Becker <becke@amazon.de> Signed-off-by: Jimmy Durand Wesolowski <jdw@amazon.de>
This commit is contained in:
parent
90a7b84679
commit
c5cc933bad
|
@ -392,8 +392,10 @@ ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos)
|
|||
iter->type |= WRITE;
|
||||
ret = file->f_op->write_iter(&kiocb, iter);
|
||||
BUG_ON(ret == -EIOCBQUEUED);
|
||||
if (ret > 0)
|
||||
if (ret > 0) {
|
||||
*ppos = kiocb.ki_pos;
|
||||
fsnotify_modify(file);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(vfs_iter_write);
|
||||
|
|
Loading…
Reference in New Issue