Skip to content
Snippets Groups Projects
  1. Aug 22, 2022
  2. Apr 25, 2022
  3. Oct 27, 2021
  4. Feb 23, 2021
  5. Dec 03, 2020
    • Amir Goldstein's avatar
      fsnotify: generalize handle_inode_event() · 950cc0d2
      Amir Goldstein authored and Jan Kara's avatar Jan Kara committed
      The handle_inode_event() interface was added as (quoting comment):
      "a simple variant of handle_event() for groups that only have inode
      marks and don't have ignore mask".
      
      In other words, all backends except fanotify.  The inotify backend
      also falls under this category, but because it required extra arguments
      it was left out of the initial pass of backends conversion to the
      simple interface.
      
      This results in code duplication between the generic helper
      fsnotify_handle_event() and the inotify_handle_event() callback
      which also happen to be buggy code.
      
      Generalize the handle_inode_event() arguments and add the check for
      FS_EXCL_UNLINK flag to the generic helper, so inotify backend could
      be converted to use the simple interface.
      
      Link: https://lore.kernel.org/r/20201202120713.702387-2-amir73il@gmail.com
      
      
      CC: stable@vger.kernel.org
      Fixes: b9a1b977 ("fsnotify: create method handle_inode_event() in fsnotify_operations")
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      950cc0d2
  6. Jul 27, 2020
    • Amir Goldstein's avatar
      fsnotify: create method handle_inode_event() in fsnotify_operations · b9a1b977
      Amir Goldstein authored and Jan Kara's avatar Jan Kara committed
      The method handle_event() grew a lot of complexity due to the design of
      fanotify and merging of ignore masks.
      
      Most backends do not care about this complex functionality, so we can hide
      this complexity from them.
      
      Introduce a method handle_inode_event() that serves those backends and
      passes a single inode mark and less arguments.
      
      This change converts all backends except fanotify and inotify to use the
      simplified handle_inode_event() method.  In pricipal, inotify could have
      also used the new method, but that would require passing more arguments
      on the simple helper (data, data_type, cookie), so we leave it with the
      handle_event() method.
      
      Link: https://lore.kernel.org/r/20200722125849.17418-9-amir73il@gmail.com
      
      
      Suggested-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      b9a1b977
    • Amir Goldstein's avatar
      audit: do not set FS_EVENT_ON_CHILD in audit marks mask · 7dbe6080
      Amir Goldstein authored and Jan Kara's avatar Jan Kara committed
      The audit group marks mask does not contain any events possible on
      a child so setting the flag FS_EVENT_ON_CHILD in the mask is counter
      productive.
      
      It may lead to the undesired outcome of setting the dentry flag
      DCACHE_FSNOTIFY_PARENT_WATCHED on a directory inode even though it is
      not watching children, because the audit mark contribute the flag
      FS_EVENT_ON_CHILD to the inode's fsnotify_mask and another mark could
      be contributing an event that is possible on child to the inode's mask.
      
      Furthermore in the following patches we want to use FS_EVENT_ON_CHILD
      for non-dir inodes for other purposes so stop using the flag.
      
      Link: https://lore.kernel.org/r/20200722125849.17418-4-amir73il@gmail.com
      
      
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      7dbe6080
    • Amir Goldstein's avatar
      fsnotify: pass dir argument to handle_event() callback · b54cecf5
      Amir Goldstein authored and Jan Kara's avatar Jan Kara committed
      
      The 'inode' argument to handle_event(), sometimes referred to as
      'to_tell' is somewhat obsolete.
      It is a remnant from the times when a group could only have an inode mark
      associated with an event.
      
      We now pass an iter_info array to the callback, with all marks associated
      with an event.
      
      Most backends ignore this argument, with two exceptions:
      1. dnotify uses it for sanity check that event is on directory
      2. fanotify uses it to report fid of directory on directory entry
         modification events
      
      Remove the 'inode' argument and add a 'dir' argument.
      The callback function signature is deliberately changed, because
      the meaning of the argument has changed and the arguments have
      been documented.
      
      The 'dir' argument is set to when 'file_name' is specified and it is
      referring to the directory that the 'file_name' entry belongs to.
      
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      b54cecf5
  7. Mar 23, 2020
  8. May 30, 2019
    • Thomas Gleixner's avatar
      treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 · c942fddf
      Thomas Gleixner authored
      
      Based on 3 normalized pattern(s):
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version this program is distributed in the
        hope that it will be useful but without any warranty without even
        the implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [kishon] [vijay] [abraham]
        [i] [kishon]@[ti] [com] this program is distributed in the hope that
        it will be useful but without any warranty without even the implied
        warranty of merchantability or fitness for a particular purpose see
        the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [graeme] [gregory]
        [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
        [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
        [hk] [hemahk]@[ti] [com] this program is distributed in the hope
        that it will be useful but without any warranty without even the
        implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
      extracted by the scancode license scanner the SPDX license identifier
      
        GPL-2.0-or-later
      
      has been chosen to replace the boilerplate/reference in 1105 file(s).
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarAllison Randal <allison@lohutok.net>
      Reviewed-by: default avatarRichard Fontana <rfontana@redhat.com>
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Cc: linux-spdx@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c942fddf
  9. Apr 29, 2019
  10. Apr 26, 2019
  11. Jan 18, 2019
  12. Nov 26, 2018
  13. Nov 19, 2018
  14. May 18, 2018
  15. May 02, 2017
  16. Apr 10, 2017
  17. Dec 05, 2016
  18. Nov 20, 2016
  19. Jan 22, 2016
    • Al Viro's avatar
      wrappers for ->i_mutex access · 5955102c
      Al Viro authored
      
      parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
      inode_foo(inode) being mutex_foo(&inode->i_mutex).
      
      Please, use those for access to ->i_mutex; over the coming cycle
      ->i_mutex will become rwsem, with ->lookup() done with it held
      only shared.
      
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      5955102c
  20. Aug 06, 2015
    • Richard Guy Briggs's avatar
      audit: clean simple fsnotify implementation · 7f492942
      Richard Guy Briggs authored
      
      This is to be used to audit by executable path rules, but audit watches should
      be able to share this code eventually.
      
      At the moment the audit watch code is a lot more complex.  That code only
      creates one fsnotify watch per parent directory.  That 'audit_parent' in
      turn has a list of 'audit_watches' which contain the name, ino, dev of
      the specific object we care about.  This just creates one fsnotify watch
      per object we care about.  So if you watch 100 inodes in /etc this code
      will create 100 fsnotify watches on /etc.  The audit_watch code will
      instead create 1 fsnotify watch on /etc (the audit_parent) and then 100
      individual watches chained from that fsnotify mark.
      
      We should be able to convert the audit_watch code to do one fsnotify
      mark per watch and simplify things/remove a whole lot of code.  After
      that conversion we should be able to convert the audit_fsnotify code to
      support that hierarchy if the optimization is necessary.
      
      Move the access to the entry for audit_match_signal() to the beginning of
      the audit_del_rule() function in case the entry found is the same one passed
      in.  This will enable it to be used by audit_autoremove_mark_rule(),
      kill_rules() and audit_remove_parent_watches().
      
      This is a heavily modified and merged version of two patches originally
      submitted by Eric Paris.
      
      Cc: Peter Moody <peter@hda3.com>
      Cc: Eric Paris <eparis@redhat.com>
      Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      [PM: added a space after a declaration to keep ./scripts/checkpatch happy]
      Signed-off-by: default avatarPaul Moore <pmoore@redhat.com>
      7f492942
Loading