mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	splice: report related fsnotify events
The fsnotify ACCESS and MODIFY event are missing when manipulating a file with splice(2). Signed-off-by: Chung-Chiang Cheng <cccheng@synology.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Acked-by: Jan Kara <jack@suse.cz> Message-Id: <20230322062519.409752-1-cccheng@synology.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
		
							parent
							
								
									364595a685
								
							
						
					
					
						commit
						983652c691
					
				
					 1 changed files with 8 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -30,6 +30,7 @@
 | 
			
		|||
#include <linux/export.h>
 | 
			
		||||
#include <linux/syscalls.h>
 | 
			
		||||
#include <linux/uio.h>
 | 
			
		||||
#include <linux/fsnotify.h>
 | 
			
		||||
#include <linux/security.h>
 | 
			
		||||
#include <linux/gfp.h>
 | 
			
		||||
#include <linux/socket.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -1165,6 +1166,9 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out,
 | 
			
		|||
		ret = do_splice_from(ipipe, out, &offset, len, flags);
 | 
			
		||||
		file_end_write(out);
 | 
			
		||||
 | 
			
		||||
		if (ret > 0)
 | 
			
		||||
			fsnotify_modify(out);
 | 
			
		||||
 | 
			
		||||
		if (!off_out)
 | 
			
		||||
			out->f_pos = offset;
 | 
			
		||||
		else
 | 
			
		||||
| 
						 | 
				
			
			@ -1188,6 +1192,10 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out,
 | 
			
		|||
			flags |= SPLICE_F_NONBLOCK;
 | 
			
		||||
 | 
			
		||||
		ret = splice_file_to_pipe(in, opipe, &offset, len, flags);
 | 
			
		||||
 | 
			
		||||
		if (ret > 0)
 | 
			
		||||
			fsnotify_access(in);
 | 
			
		||||
 | 
			
		||||
		if (!off_in)
 | 
			
		||||
			in->f_pos = offset;
 | 
			
		||||
		else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue