[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240902140420.dz4xxreo77fupphy@quack3>
Date: Mon, 2 Sep 2024 16:04:20 +0200
From: Jan Kara <jack@...e.cz>
To: imandevel@...il.com
Cc: jack@...e.cz, amir73il@...il.com, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] inotify: set ret in inotify_read() to -EAGAIN only when
O_NONBLOCK is set
On Sat 31-08-24 23:01:50, imandevel@...il.com wrote:
> From: Iman Seyed <ImanDevel@...il.com>
>
> Avoid setting ret to -EAGAIN unnecessarily. Only set
> it when O_NONBLOCK is specified; otherwise, leave ret
> unchanged and proceed to set it to -ERESTARTSYS.
>
> Signed-off-by: Iman Seyed <ImanDevel@...il.com>
Sorry, but this change is a pointless churn. There's no difference to
generated code and wrt source code appearance it is a matter of taste where
there's no strong preference one way or other in the kernel...
Honza
> ---
> fs/notify/inotify/inotify_user.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
> index 4ffc30606e0b..d5d4b306a33d 100644
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -279,9 +279,11 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
> continue;
> }
>
> - ret = -EAGAIN;
> - if (file->f_flags & O_NONBLOCK)
> + if (file->f_flags & O_NONBLOCK) {
> + ret = -EAGAIN;
> break;
> + }
> +
> ret = -ERESTARTSYS;
> if (signal_pending(current))
> break;
> --
> 2.46.0
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists