[v2,3/3] splice: fsnotify_access(in), fsnotify_modify(out) on success in tee

Message ID sun5nn6nzp7cvn43m7476rchcel42zuxv6mo2fab6tu24wc2it@intt5usuvpoq
State New
Headers
Series fanotify accounting for fs/splice.c |

Commit Message

Ahelenia Ziemiańska June 26, 2023, 11:09 p.m. UTC
  Same logic applies here: this can fill up the pipe, and pollers that rely
on getting IN_MODIFY notifications never wake up.

Fixes: 983652c69199 ("splice: report related fsnotify events")
Link: https://lore.kernel.org/linux-fsdevel/jbyihkyk5dtaohdwjyivambb2gffyjs3dodpofafnkkunxq7bu@jngkdxx65pux/t/#u
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
 fs/splice.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Amir Goldstein June 27, 2023, 6:20 a.m. UTC | #1
On Tue, Jun 27, 2023 at 2:09 AM Ahelenia Ziemiańska
<nabijaczleweli@nabijaczleweli.xyz> wrote:
>
> Same logic applies here: this can fill up the pipe, and pollers that rely
> on getting IN_MODIFY notifications never wake up.
>
> Fixes: 983652c69199 ("splice: report related fsnotify events")
> Link: https://lore.kernel.org/linux-fsdevel/jbyihkyk5dtaohdwjyivambb2gffyjs3dodpofafnkkunxq7bu@jngkdxx65pux/t/#u
> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>

Makes sense.

Reviewed-by: Amir Goldstein <amir73il@gmail.com>

> ---
>  fs/splice.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/fs/splice.c b/fs/splice.c
> index a18274209dc1..3234aaa6e957 100644
> --- a/fs/splice.c
> +++ b/fs/splice.c
> @@ -1819,6 +1819,11 @@ long do_tee(struct file *in, struct file *out, size_t len, unsigned int flags)
>                 }
>         }
>
> +       if (ret > 0) {
> +               fsnotify_access(in);
> +               fsnotify_modify(out);
> +       }
> +
>         return ret;
>  }
>
> --
> 2.39.2
  

Patch

diff --git a/fs/splice.c b/fs/splice.c
index a18274209dc1..3234aaa6e957 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1819,6 +1819,11 @@  long do_tee(struct file *in, struct file *out, size_t len, unsigned int flags)
 		}
 	}
 
+	if (ret > 0) {
+		fsnotify_access(in);
+		fsnotify_modify(out);
+	}
+
 	return ret;
 }