Merge tag 'fsnotify_for_v4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Aug 2018 16:41:28 +0000 (09:41 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Aug 2018 16:41:28 +0000 (09:41 -0700)
Pull fsnotify updates from Jan Kara:
 "fsnotify cleanups from Amir and a small inotify improvement"

* tag 'fsnotify_for_v4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  inotify: Add flag IN_MASK_CREATE for inotify_add_watch()
  fanotify: factor out helpers to add/remove mark
  fsnotify: add helper to get mask from connector
  fsnotify: let connector point to an abstract object
  fsnotify: pass connp and object type to fsnotify_add_mark()
  fsnotify: use typedef fsnotify_connp_t for brevity

1  2 
kernel/audit_tree.c

diff --combined kernel/audit_tree.c
@@@ -168,7 -168,8 +168,8 @@@ static __cacheline_aligned_in_smp DEFIN
  /* Function to return search key in our hash from inode. */
  static unsigned long inode_to_key(const struct inode *inode)
  {
-       return (unsigned long)inode;
+       /* Use address pointed to by connector->obj as the key */
+       return (unsigned long)&inode->i_fsnotify_marks;
  }
  
  /*
@@@ -183,7 -184,7 +184,7 @@@ static unsigned long chunk_to_key(struc
         */
        if (WARN_ON_ONCE(!chunk->mark.connector))
                return 0;
-       return (unsigned long)chunk->mark.connector->inode;
+       return (unsigned long)chunk->mark.connector->obj;
  }
  
  static inline struct list_head *chunk_hash(unsigned long key)
@@@ -258,7 -259,7 +259,7 @@@ static void untag_chunk(struct node *p
        spin_lock(&entry->lock);
        /*
         * mark_mutex protects mark from getting detached and thus also from
-        * mark->connector->inode getting NULL.
+        * mark->connector->obj getting NULL.
         */
        if (chunk->dead || !(entry->flags & FSNOTIFY_MARK_FLAG_ATTACHED)) {
                spin_unlock(&entry->lock);
        if (!new)
                goto Fallback;
  
-       if (fsnotify_add_inode_mark_locked(&new->mark, entry->connector->inode,
-                                          1)) {
+       if (fsnotify_add_mark_locked(&new->mark, entry->connector->obj,
+                                    FSNOTIFY_OBJ_TYPE_INODE, 1)) {
                fsnotify_put_mark(&new->mark);
                goto Fallback;
        }
@@@ -423,7 -424,7 +424,7 @@@ static int tag_chunk(struct inode *inod
        spin_lock(&old_entry->lock);
        /*
         * mark_mutex protects mark from getting detached and thus also from
-        * mark->connector->inode getting NULL.
+        * mark->connector->obj getting NULL.
         */
        if (!(old_entry->flags & FSNOTIFY_MARK_FLAG_ATTACHED)) {
                /* old_entry is being shot, lets just lie */
                return -ENOENT;
        }
  
-       if (fsnotify_add_inode_mark_locked(chunk_entry,
-                            old_entry->connector->inode, 1)) {
+       if (fsnotify_add_mark_locked(chunk_entry, old_entry->connector->obj,
+                                    FSNOTIFY_OBJ_TYPE_INODE, 1)) {
                spin_unlock(&old_entry->lock);
                mutex_unlock(&old_entry->group->mark_mutex);
                fsnotify_put_mark(chunk_entry);
@@@ -497,8 -498,6 +498,8 @@@ static void audit_tree_log_remove_rule(
  {
        struct audit_buffer *ab;
  
 +      if (!audit_enabled)
 +              return;
        ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);
        if (unlikely(!ab))
                return;