]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Nov 2018 13:19:23 +0000 (14:19 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Nov 2018 13:19:23 +0000 (14:19 +0100)
added patches:
fsnotify-generalize-handling-of-extra-event-flags.patch

queue-4.19/fanotify-fix-handling-of-events-on-child-sub-directory.patch
queue-4.19/fsnotify-generalize-handling-of-extra-event-flags.patch [new file with mode: 0644]
queue-4.19/series

index c1c120c9d84d27a8a479d77524d6b8470dd002d3..4d9cfcd8a995dea92860cfae22402fb36c4788a5 100644 (file)
@@ -74,7 +74,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
                struct name_snapshot name;
  
                /* we are notifying a parent so come up with the new mask which
-@@ -332,6 +332,10 @@ int fsnotify(struct inode *to_tell, __u3
+@@ -331,6 +331,10 @@ int fsnotify(struct inode *to_tell, __u3
        else
                mnt = NULL;
  
diff --git a/queue-4.19/fsnotify-generalize-handling-of-extra-event-flags.patch b/queue-4.19/fsnotify-generalize-handling-of-extra-event-flags.patch
new file mode 100644 (file)
index 0000000..49fcd8a
--- /dev/null
@@ -0,0 +1,88 @@
+From 007d1e8395eaa59b0e7ad9eb2b53a40859446a88 Mon Sep 17 00:00:00 2001
+From: Amir Goldstein <amir73il@gmail.com>
+Date: Thu, 4 Oct 2018 00:25:33 +0300
+Subject: fsnotify: generalize handling of extra event flags
+
+From: Amir Goldstein <amir73il@gmail.com>
+
+commit 007d1e8395eaa59b0e7ad9eb2b53a40859446a88 upstream.
+
+FS_EVENT_ON_CHILD gets a special treatment in fsnotify() because it is
+not a flag specifying an event type, but rather an extra flags that may
+be reported along with another event and control the handling of the
+event by the backend.
+
+FS_ISDIR is also an "extra flag" and not an "event type" and therefore
+desrves the same treatment. With inotify/dnotify backends it was never
+possible to set FS_ISDIR in mark masks, so it did not matter.
+With fanotify backend, mark adding code jumps through hoops to avoid
+setting the FS_ISDIR in the commulative object mask.
+
+Separate the constant ALL_FSNOTIFY_EVENTS to ALL_FSNOTIFY_FLAGS and
+ALL_FSNOTIFY_EVENTS, so the latter can be used to test for specific
+event types.
+
+Signed-off-by: Amir Goldstein <amir73il@gmail.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/notify/fsnotify.c             |    7 +++----
+ include/linux/fsnotify_backend.h |    9 +++++++--
+ 2 files changed, 10 insertions(+), 6 deletions(-)
+
+--- a/fs/notify/fsnotify.c
++++ b/fs/notify/fsnotify.c
+@@ -193,7 +193,7 @@ static int send_to_group(struct inode *t
+                        struct fsnotify_iter_info *iter_info)
+ {
+       struct fsnotify_group *group = NULL;
+-      __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD);
++      __u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS);
+       __u32 marks_mask = 0;
+       __u32 marks_ignored_mask = 0;
+       struct fsnotify_mark *mark;
+@@ -324,8 +324,7 @@ int fsnotify(struct inode *to_tell, __u3
+       struct fsnotify_iter_info iter_info = {};
+       struct mount *mnt;
+       int ret = 0;
+-      /* global tests shouldn't care about events on child only the specific event */
+-      __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD);
++      __u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS);
+       if (data_is == FSNOTIFY_EVENT_PATH)
+               mnt = real_mount(((const struct path *)data)->mnt);
+@@ -389,7 +388,7 @@ static __init int fsnotify_init(void)
+ {
+       int ret;
+-      BUG_ON(hweight32(ALL_FSNOTIFY_EVENTS) != 23);
++      BUG_ON(hweight32(ALL_FSNOTIFY_BITS) != 23);
+       ret = init_srcu_struct(&fsnotify_mark_srcu);
+       if (ret)
+--- a/include/linux/fsnotify_backend.h
++++ b/include/linux/fsnotify_backend.h
+@@ -68,15 +68,20 @@
+ #define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM)
++/* Events that can be reported to backends */
+ #define ALL_FSNOTIFY_EVENTS (FS_ACCESS | FS_MODIFY | FS_ATTRIB | \
+                            FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN | \
+                            FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \
+                            FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \
+                            FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \
+-                           FS_OPEN_PERM | FS_ACCESS_PERM | FS_EXCL_UNLINK | \
+-                           FS_ISDIR | FS_IN_ONESHOT | FS_DN_RENAME | \
++                           FS_OPEN_PERM | FS_ACCESS_PERM | FS_DN_RENAME)
++
++/* Extra flags that may be reported with event or control handling of events */
++#define ALL_FSNOTIFY_FLAGS  (FS_EXCL_UNLINK | FS_ISDIR | FS_IN_ONESHOT | \
+                            FS_DN_MULTISHOT | FS_EVENT_ON_CHILD)
++#define ALL_FSNOTIFY_BITS   (ALL_FSNOTIFY_EVENTS | ALL_FSNOTIFY_FLAGS)
++
+ struct fsnotify_group;
+ struct fsnotify_event;
+ struct fsnotify_mark;
index 95bde92187fef8af4a70c005cc12f91b41d2e38b..a6475a182e14600b2b038672c789277705482c09 100644 (file)
@@ -60,4 +60,5 @@ can-flexcan-always-use-last-mailbox-for-tx.patch
 can-flexcan-remove-not-needed-struct-flexcan_priv-tx_mb-and-struct-flexcan_priv-tx_mb_idx.patch
 acpica-aml-interpreter-add-region-addresses-in-global-list-during-initialization.patch
 ib-hfi1-eliminate-races-in-the-sdma-send-error-path.patch
+fsnotify-generalize-handling-of-extra-event-flags.patch
 fanotify-fix-handling-of-events-on-child-sub-directory.patch