[PATCH 2/2] fanotify: remove obsolete check for overflow event in create_fd()

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

 



In create_fd() we check if mount and dentry of the passed event are NULL.
This cant happen any more since we dont call this function for the overflow
event any longer. So we can remove this check.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@xxxxxx>
---
 fs/notify/fanotify/fanotify_user.c |   35 +++++++++++++++--------------------
 1 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index e108960..0dce0d4 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -82,28 +82,23 @@ static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event)
 	 */
 	dentry = dget(event->path.dentry);
 	mnt = mntget(event->path.mnt);
-	/* it's possible this event was an overflow event.  in that case dentry and mnt
-	 * are NULL;  That's fine, just don't call dentry open */
-	if (dentry && mnt) {
-		flags = group->fanotify_data.f_flags;
+
+	flags = group->fanotify_data.f_flags;
+	new_file = dentry_open(dentry, mnt, flags, current_cred());
+	/*
+	 * Attempt fallback to read-only access if writable was not possible
+	 * in order to at least provide something to the listener.
+	 */
+	if (IS_ERR(new_file) && group->fanotify_data.readonly_fallback) {
+		/* dentry_open() put our refs, so get them again... */
+		dentry = dget(event->path.dentry);
+		mnt = mntget(event->path.mnt);
+
+		flags &= ~O_ACCMODE;
+		flags |= O_RDONLY;
 		new_file = dentry_open(dentry, mnt, flags, current_cred());
-		/*
-		 * Attempt fallback to read-only access if writable was not possible
-		 * in order to at least provide something to the listener.
-		 */
-		if (IS_ERR(new_file) && group->fanotify_data.readonly_fallback) {
-			/* dentry_open() put our refs, so get them again... */
-			dentry = dget(event->path.dentry);
-			mnt = mntget(event->path.mnt);
-
-			flags &= ~O_ACCMODE;
-			flags |= O_RDONLY;
-			new_file = dentry_open(dentry, mnt, flags,
-					       current_cred());
-		}
-	} else {
-		new_file = ERR_PTR(-EOVERFLOW);
 	}
+
 	if (IS_ERR(new_file)) {
 		/*
 		 * we still send an event even if we can't open the file.  this
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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