[PATCH] inotify: set ret in inotify_read() to -EAGAIN only when O_NONBLOCK is set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Iman Seyed <ImanDevel@xxxxxxxxx>

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@xxxxxxxxx>
---
 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





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux